結果

問題 No.709 優勝可能性
ユーザー potoooooooopotoooooooo
提出日時 2018-06-29 23:30:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 504 ms / 3,500 ms
コード長 683 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 167,544 KB
実行使用メモリ 6,324 KB
最終ジャッジ日時 2023-09-13 15:42:54
合計ジャッジ時間 7,052 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 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 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 248 ms
4,376 KB
testcase_11 AC 175 ms
4,376 KB
testcase_12 AC 396 ms
4,376 KB
testcase_13 AC 369 ms
4,380 KB
testcase_14 AC 322 ms
4,380 KB
testcase_15 AC 298 ms
4,380 KB
testcase_16 AC 286 ms
4,380 KB
testcase_17 AC 288 ms
6,324 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 503 ms
4,376 KB
testcase_21 AC 504 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n, m; cin >> n >> m;
  vector<int> v[m]; vector<int> count(n, 0), maxi(m, 0);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int k; cin >> k;
      if (maxi[j] == k) {
        count[i]++; if (count[i] == 1) ans++;
        v[j].push_back(i);
      } else if (maxi[j] < k) {
        maxi[j] = k;
        for (int u = 0; u < (int) v[j].size(); u++){
          count[v[j][u]]--;
          if (count[v[j][u]] == 0) ans--;
        }
        v[j].clear();
        count[i]++; if (count[i] == 1) ans++;
        v[j].push_back(i);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
0