結果

問題 No.709 優勝可能性
ユーザー simansiman
提出日時 2022-08-17 17:31:45
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 639 ms / 3,500 ms
コード長 1,116 bytes
コンパイル時間 2,809 ms
コンパイル使用メモリ 142,408 KB
実行使用メモリ 36,188 KB
最終ジャッジ日時 2024-04-15 06:39:18
合計ジャッジ時間 6,800 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 259 ms
9,696 KB
testcase_11 AC 179 ms
8,852 KB
testcase_12 AC 425 ms
11,436 KB
testcase_13 AC 385 ms
12,348 KB
testcase_14 AC 341 ms
12,468 KB
testcase_15 AC 319 ms
12,612 KB
testcase_16 AC 387 ms
15,332 KB
testcase_17 AC 639 ms
36,188 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 532 ms
12,320 KB
testcase_21 AC 530 ms
12,440 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int N, M;
  cin >> N >> M;
  int R[N][M];

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      cin >> R[i][j];
    }
  }

  set<int> S[N];
  int left = 0;
  int v_counter[N];
  memset(v_counter, 0, sizeof(v_counter));
  int max_values[M];
  memset(max_values, 0, sizeof(max_values));
  int ans = 0;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      if (max_values[j] < R[i][j]) {
        for (int s : S[j]) {
          v_counter[s]--;
          if (v_counter[s] == 0) {
            --ans;
          }
        }
        S[j].clear();

        v_counter[i]++;
        max_values[j] = R[i][j];
        S[j].insert(i);
      } else if (max_values[j] == R[i][j]) {
        v_counter[i]++;
        S[j].insert(i);
      }
    }
    if (v_counter[i] > 0) {
      ++ans;
    }

    cout << ans << endl;
  }

  return 0;
}
0