結果

問題 No.709 優勝可能性
ユーザー simansiman
提出日時 2022-08-17 17:29:52
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,094 bytes
コンパイル時間 1,467 ms
コンパイル使用メモリ 144,632 KB
実行使用メモリ 22,124 KB
最終ジャッジ日時 2024-04-15 06:38:09
合計ジャッジ時間 9,180 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 235 ms
9,880 KB
testcase_11 AC 168 ms
9,008 KB
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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;
          }
        }

        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