結果

問題 No.709 優勝可能性
ユーザー nebukuro09nebukuro09
提出日時 2018-06-29 23:56:14
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 285 ms / 3,500 ms
コード長 982 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 104,800 KB
実行使用メモリ 22,612 KB
最終ジャッジ日時 2023-09-03 20:28:36
合計ジャッジ時間 6,697 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 142 ms
13,036 KB
testcase_11 AC 103 ms
13,752 KB
testcase_12 AC 210 ms
14,076 KB
testcase_13 AC 230 ms
18,036 KB
testcase_14 AC 207 ms
20,172 KB
testcase_15 AC 197 ms
13,852 KB
testcase_16 AC 216 ms
14,972 KB
testcase_17 AC 271 ms
22,612 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 284 ms
14,992 KB
testcase_21 AC 285 ms
15,216 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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, std.bitmanip;

void main() {
    auto t = readln.split.map!(to!int);
    auto N = t[0];
    auto M = t[1];
    auto R = N.iota.map!(_ => readln.split.map!(to!int).array).array;

    int ans = 0;
    auto C = new int[](N);
    auto S = new int[][](M);
    auto V = new int[](M);
    V.fill(-1);

    foreach (i; 0..N) {
        foreach (j; 0..M) {
            if (R[i][j] > V[j]) {
                foreach (s; S[j]) {
                    C[s] -= 1;
                    if (C[s] == 0) ans -= 1;
                }
                S[j] = [i];
                C[i] += 1;
                V[j] = R[i][j];
            } else if (R[i][j] == V[j]) {
                S[j] ~= i;
                C[i] += 1;
            }
        }
        if (C[i] > 0) {
            ans += 1;
        }
        ans.writeln;
    }
}
0