結果

問題 No.709 優勝可能性
ユーザー 0x19f0x19f
提出日時 2018-06-29 23:57:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 517 ms / 3,500 ms
コード長 840 bytes
コンパイル時間 1,275 ms
コンパイル使用メモリ 150,528 KB
実行使用メモリ 21,056 KB
最終ジャッジ日時 2023-09-13 15:51:26
合計ジャッジ時間 6,245 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 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 252 ms
9,360 KB
testcase_11 AC 175 ms
9,492 KB
testcase_12 AC 404 ms
12,460 KB
testcase_13 AC 362 ms
15,376 KB
testcase_14 AC 328 ms
15,496 KB
testcase_15 AC 302 ms
15,744 KB
testcase_16 AC 288 ms
16,748 KB
testcase_17 AC 299 ms
21,056 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 516 ms
15,432 KB
testcase_21 AC 517 ms
15,756 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<vector<ll>> R(N, vector<ll>(M));
  REP(i, 0, N) REP(j, 0, M) cin >> R[i][j];

  vector<vector<ll>> current(M);
  vector<ll> cnt(N, 0);
  vector<ll> value(M, 0);
  ll ans = 0;
  REP(i, 0, N) {
    bool ok = false;
    REP(j, 0, M) {
      if(value[j] < R[i][j]) {
        cnt[i]++;
        for(ll k : current[j]) {
          cnt[k]--;
          if(cnt[k] == 0) ans--;
        }
        value[j] = R[i][j];
        current[j].clear();
        current[j].push_back(i);
        ok = true;
      } else if(value[j] == R[i][j]) {
        cnt[i]++;
        current[j].push_back(i);
        ok = true;
      }
    }
    if(ok) ans++;
    cout << ans << endl;
  }
}
0