結果

問題 No.709 優勝可能性
ユーザー nebukuro09
提出日時 2018-06-29 23:56:14
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 263 ms / 3,500 ms
コード長 982 bytes
コンパイル時間 991 ms
コンパイル使用メモリ 118,840 KB
実行使用メモリ 22,604 KB
最終ジャッジ日時 2024-06-13 01:16:44
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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