結果

問題 No.709 優勝可能性
ユーザー finefine
提出日時 2018-06-29 22:49:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 397 ms / 3,500 ms
コード長 970 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 179,920 KB
実行使用メモリ 17,628 KB
最終ジャッジ日時 2023-09-13 15:30:33
合計ジャッジ時間 5,934 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 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 177 ms
8,556 KB
testcase_11 AC 156 ms
8,552 KB
testcase_12 AC 231 ms
10,384 KB
testcase_13 AC 235 ms
10,096 KB
testcase_14 AC 219 ms
10,140 KB
testcase_15 AC 224 ms
10,156 KB
testcase_16 AC 298 ms
11,648 KB
testcase_17 AC 397 ms
17,628 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 257 ms
10,244 KB
testcase_21 AC 260 ms
10,256 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector< vector<int> > cur(m);
    vector< vector<int> > r(n, vector<int>(m));
    map<int, int> cnt;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> r[i][j];
            if (cur[j].empty() || r[i][j] == r[cur[j].front()][j]) {
                cur[j].push_back(i);
                cnt[i]++;
            } else if (r[i][j] > r[cur[j].front()][j])  {
                while (!cur[j].empty()) {
                    cnt[cur[j].back()]--;
                    if (cnt[cur[j].back()] == 0) {
                        cnt.erase(cur[j].back());
                    }
                    cur[j].pop_back();
                }
                cur[j].push_back(i);
                cnt[i]++;
            }
        }

        cout << cnt.size() << endl;
    }
    return 0;
}
0