結果

問題 No.709 優勝可能性
ユーザー MisterMister
提出日時 2020-08-02 16:16:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 118 ms / 3,500 ms
コード長 823 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 76,624 KB
実行使用メモリ 6,440 KB
最終ジャッジ日時 2023-09-25 20:54:11
合計ジャッジ時間 4,462 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 42 ms
4,380 KB
testcase_11 AC 20 ms
4,376 KB
testcase_12 AC 87 ms
4,388 KB
testcase_13 AC 86 ms
4,376 KB
testcase_14 AC 78 ms
4,380 KB
testcase_15 AC 72 ms
4,376 KB
testcase_16 AC 69 ms
4,376 KB
testcase_17 AC 71 ms
6,440 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 118 ms
4,504 KB
testcase_21 AC 117 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<int> cnt(n, 0), maxs(m, 0);
    std::vector<std::vector<int>> bests(m);
    int ans = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            int x;
            std::cin >> x;

            if (x > maxs[j]) {
                for (auto k : bests[j]) {
                    if (--cnt[k] == 0) --ans;
                }
                bests[j].clear();
                maxs[j] = x;
            }

            if (x == maxs[j]) {
                if (cnt[i]++ == 0) ++ans;
                bests[j].push_back(i);
            }
        }

        std::cout << ans << "\n";
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0