Submission #185570


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
 
class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
 
 
    void calc()
    {
        string[] st = splitLine(2, 2);
        int H = getInt(st[0], 1, 100);
        int W = getInt(st[1], 1, 100);
 
        int[,] C = new int[H, W];
        int[,] D = new int[H, W];
 
        for (int i = 0; i < H; i++)
        {
            st = splitLine(W, W);
            for (int j = 0; j < W; j++)
            {
                C[i, j] = getInt(st[j], 0, 99);
                if ((i + j) % 2 == 1)
                {
                    C[i, j] = -C[i, j];
                }
            }
        }
 
        int[,] sumC = new int[H + 1, W + 1];
 
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                sumC[i + 1, j + 1] = C[i, j] + sumC[i + 1, j] + sumC[i, j + 1] - sumC[i, j];
            }
        }
 
        int ret = 0;
         
        for (int i = 0; i < H; i++)
        {
            for (int j = i + 1; j <= H; j++)
            {
                for (int k = 0; k < W; k++)
                {
                    for (int l = k + 1; l <= W; l++)
                    {
                        if (sumC[j, l] - sumC[i, l] - sumC[j, k] + sumC[i, k] == 0)
                        {
                            ret = Math.Max(ret, (j - i) * (l - k));
                        }
                    }
                }
            }
        }
        Console.WriteLine(ret);
    }
 
    //swap
    void swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }
 
    void myon(string s)
    {
        throw new Exception(s);
    }
 
    int getInt(string s, int min, int max)
    {
        int ret = int.Parse(s);
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }
 
    int getIntLine(int min, int max)
    {
        int ret = int.Parse(Console.ReadLine());
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }
 
    double getDouble(string s, double min, double max)
    {
        double ret = double.Parse(s);
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }
 
    double getDoubleLine(double min, double max)
    {
        double ret = double.Parse(Console.ReadLine());
        if (ret < min) throw new Exception("low");
        if (ret > max) throw new Exception("high");
        return ret;
    }
 
    string getString(string s, int min, int max)
    {
        if (s.Length < min) throw new Exception("low");
        if (s.Length > max) throw new Exception("high");
        return s;
    }
 
    string getStringLine(int min, int max)
    {
        string s = Console.ReadLine();
        if (s.Length < min) throw new Exception("low");
        if (s.Length > max) throw new Exception("high");
        return s;
    }
 
    string[] splitLine(int min, int max)
    {
        string[] ret = Console.ReadLine().Split(' ');
        if (ret.Length == 1 && ret[0] == "") ret = new string[0];
        if (ret.Length < min || ret.Length > max) throw new Exception("wrong length");
        return ret;
    }
}

Submission Info

Submission Time
Task B - チョコレート
User chokudai
Language C# (Mono 2.10.8.1)
Score 100
Code Size 3502 Byte
Status AC
Exec Time 681 ms
Memory 8136 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 5
AC × 25
Set Name Test Cases
Sample subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt
All subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask0_sample-05.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Case Name Status Exec Time Memory
subtask0_sample-01.txt AC 137 ms 7836 KB
subtask0_sample-02.txt AC 135 ms 7700 KB
subtask0_sample-03.txt AC 131 ms 7800 KB
subtask0_sample-04.txt AC 136 ms 7816 KB
subtask0_sample-05.txt AC 136 ms 7836 KB
subtask1_01.txt AC 131 ms 7940 KB
subtask1_02.txt AC 132 ms 7816 KB
subtask1_03.txt AC 135 ms 7804 KB
subtask1_04.txt AC 139 ms 7852 KB
subtask1_05.txt AC 135 ms 7944 KB
subtask1_06.txt AC 134 ms 7832 KB
subtask1_07.txt AC 130 ms 7936 KB
subtask1_08.txt AC 131 ms 7836 KB
subtask1_09.txt AC 649 ms 8056 KB
subtask1_10.txt AC 206 ms 7956 KB
subtask1_11.txt AC 630 ms 8124 KB
subtask1_12.txt AC 627 ms 8096 KB
subtask1_13.txt AC 630 ms 8096 KB
subtask1_14.txt AC 652 ms 8056 KB
subtask1_15.txt AC 656 ms 8060 KB
subtask1_16.txt AC 608 ms 8136 KB
subtask1_17.txt AC 549 ms 8084 KB
subtask1_18.txt AC 133 ms 7840 KB
subtask1_19.txt AC 132 ms 7956 KB
subtask1_20.txt AC 681 ms 8088 KB