Submission #1337513


Source Code Expand

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable int INF = 1 << 29;

void main() {
    auto s = readln.split.map!(to!int);
    auto H = s[0];
    auto W = s[1];
    auto A = H.iota.map!(_ => readln.split.map!(to!int).array).array;


    int ans = 0;

    foreach (i; 0..H) {
        if (i != 0) foreach (j; 0..W) A[i][j] ^= 1;

        int maxtmp = 0;
        
        foreach (j; 0..W) {
            int tmp = 0;
            int[] B = A[i].dup;
            foreach (k; 0..j) {
                tmp += B[k];
                if (k < W - 1) B[k + 1] ^= 1;
            }
            for (int k = W - 1; k >= j; k--) {
                tmp += B[k];
                if (k > 0) B[k - 1] ^= 1;
            }
            maxtmp = max(tmp, maxtmp);
        }

        ans += maxtmp;
    }


    ans.writeln;
}

Submission Info

Submission Time
Task C - チョコレート
User nebukuro09
Language D (LDC 0.17.0)
Score 250
Code Size 997 Byte
Status AC
Exec Time 9 ms
Memory 1276 KB

Judge Result

Set Name All
Score / Max Score 250 / 250
Status
AC × 76
Set Name Test Cases
All 00_min_00.txt, 00_min_01.txt, 00_teuchi_01.txt, 00_teuchi_02.txt, 01_or_12.txt, 01_or_13.txt, 01_or_14.txt, 01_or_15.txt, 01_or_16.txt, 01_or_17.txt, 01_or_18.txt, 01_or_19.txt, 01_or_20.txt, 01_or_21.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 02_oc_22.txt, 02_oc_23.txt, 02_oc_24.txt, 02_oc_25.txt, 02_oc_26.txt, 02_oc_27.txt, 02_oc_28.txt, 02_oc_29.txt, 02_oc_30.txt, 02_oc_31.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 10_asi_24.txt, 10_random_00.txt, 10_random_01.txt, 10_random_02.txt, 10_random_03.txt, 10_random_04.txt, 10_random_05.txt, 10_random_06.txt, 10_random_07.txt, 10_random_08.txt
Case Name Status Exec Time Memory
00_min_00.txt AC 1 ms 256 KB
00_min_01.txt AC 1 ms 256 KB
00_teuchi_01.txt AC 1 ms 256 KB
00_teuchi_02.txt AC 1 ms 256 KB
01_or_12.txt AC 1 ms 256 KB
01_or_13.txt AC 1 ms 256 KB
01_or_14.txt AC 1 ms 256 KB
01_or_15.txt AC 1 ms 256 KB
01_or_16.txt AC 1 ms 256 KB
01_or_17.txt AC 1 ms 380 KB
01_or_18.txt AC 1 ms 380 KB
01_or_19.txt AC 1 ms 380 KB
01_or_20.txt AC 1 ms 380 KB
01_or_21.txt AC 1 ms 380 KB
01_random_00.txt AC 1 ms 256 KB
01_random_01.txt AC 1 ms 256 KB
01_random_02.txt AC 9 ms 1276 KB
01_random_03.txt AC 9 ms 1276 KB
01_random_04.txt AC 9 ms 1276 KB
01_random_05.txt AC 9 ms 1276 KB
01_random_06.txt AC 9 ms 1276 KB
01_random_07.txt AC 9 ms 1276 KB
01_random_08.txt AC 9 ms 1276 KB
01_random_09.txt AC 9 ms 1276 KB
01_random_10.txt AC 9 ms 1276 KB
01_random_11.txt AC 9 ms 1276 KB
01_random_12.txt AC 1 ms 256 KB
01_random_13.txt AC 1 ms 256 KB
01_random_14.txt AC 1 ms 256 KB
01_random_15.txt AC 1 ms 256 KB
01_random_16.txt AC 1 ms 256 KB
01_random_17.txt AC 1 ms 380 KB
01_random_18.txt AC 1 ms 380 KB
01_random_19.txt AC 1 ms 380 KB
01_random_20.txt AC 1 ms 380 KB
01_random_21.txt AC 1 ms 380 KB
01_random_22.txt AC 1 ms 256 KB
01_random_23.txt AC 1 ms 256 KB
01_random_24.txt AC 1 ms 256 KB
01_random_25.txt AC 1 ms 256 KB
01_random_26.txt AC 1 ms 256 KB
01_random_27.txt AC 1 ms 256 KB
01_random_28.txt AC 1 ms 256 KB
01_random_29.txt AC 1 ms 256 KB
01_random_30.txt AC 1 ms 256 KB
01_random_31.txt AC 1 ms 256 KB
02_oc_22.txt AC 1 ms 256 KB
02_oc_23.txt AC 1 ms 256 KB
02_oc_24.txt AC 1 ms 256 KB
02_oc_25.txt AC 1 ms 256 KB
02_oc_26.txt AC 1 ms 256 KB
02_oc_27.txt AC 1 ms 256 KB
02_oc_28.txt AC 1 ms 256 KB
02_oc_29.txt AC 1 ms 256 KB
02_oc_30.txt AC 1 ms 256 KB
02_oc_31.txt AC 1 ms 256 KB
03_random_02.txt AC 9 ms 1276 KB
03_random_03.txt AC 9 ms 1276 KB
03_random_04.txt AC 9 ms 1276 KB
03_random_05.txt AC 9 ms 1276 KB
03_random_06.txt AC 9 ms 1276 KB
03_random_07.txt AC 9 ms 1276 KB
03_random_08.txt AC 9 ms 1276 KB
03_random_09.txt AC 9 ms 1276 KB
03_random_10.txt AC 9 ms 1276 KB
03_random_11.txt AC 9 ms 1276 KB
10_asi_24.txt AC 9 ms 1276 KB
10_random_00.txt AC 1 ms 256 KB
10_random_01.txt AC 9 ms 1276 KB
10_random_02.txt AC 1 ms 256 KB
10_random_03.txt AC 1 ms 256 KB
10_random_04.txt AC 1 ms 256 KB
10_random_05.txt AC 1 ms 256 KB
10_random_06.txt AC 1 ms 256 KB
10_random_07.txt AC 1 ms 256 KB
10_random_08.txt AC 1 ms 256 KB