結果

問題 No.709 優勝可能性
ユーザー kk
提出日時 2020-09-03 18:44:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 638 ms / 3,500 ms
コード長 985 bytes
コンパイル時間 2,486 ms
コンパイル使用メモリ 213,576 KB
実行使用メモリ 35,328 KB
最終ジャッジ日時 2024-05-03 01:11:57
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 172 ms
7,552 KB
testcase_11 AC 145 ms
7,424 KB
testcase_12 AC 257 ms
7,936 KB
testcase_13 AC 231 ms
7,296 KB
testcase_14 AC 210 ms
7,296 KB
testcase_15 AC 215 ms
7,680 KB
testcase_16 AC 363 ms
11,264 KB
testcase_17 AC 638 ms
35,328 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 250 ms
7,424 KB
testcase_21 AC 250 ms
7,296 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);

int r[100000][10];
set<int> cur[10];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  cin >> n >> m;
  REP (i, n) REP (j, m) cin >> r[i][j];

  map<int, int> winner;  
  REP (i, n) {
    REP (j, m) {
      if (cur[j].empty()) {
        cur[j].insert(i);
        ++winner[i];
      }
      else {
        int best = r[*cur[j].begin()][j];
        if (r[i][j] == best) {
          cur[j].insert(i);
          ++winner[i];          
        } else if (r[i][j] > best) {
          for (int x: cur[j]) {
            if (!--winner[x])
              winner.erase(x);
          }
          cur[j].clear();
          cur[j].insert(i);
          ++winner[i];          
        }
      }
    }
    cout << winner.size() << endl;
  }
  
  return 0;
}
0