結果

問題 No.709 優勝可能性
ユーザー rpy3cpp
提出日時 2018-08-11 23:51:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 124 ms / 3,500 ms
コード長 913 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 172,076 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-23 06:39:25
合計ジャッジ時間 3,930 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> Record(M, 0);
    vector<vector<int>> candidates(M);
    vector<int> status(N, 0);
    int num = 0;
    for (int n = 0; n < N; ++n){
        for (int m = 0; m < M; ++m){
            int R;
            cin >> R;
            if (R > Record[m]){
                if (status[n] == 0) ++num;
                ++status[n];
                Record[m] = R;
                for (auto c : candidates[m]){
                    --status[c];
                    if (status[c] == 0) --num;
                }
                candidates[m] = {n};
            }else if(R == Record[m]){
                if (status[n] == 0) ++num;
                ++status[n];
                candidates[m].push_back(n);
            }
        }
        cout << num << '\n';
    }
    return 0;
}
0