結果

問題 No.709 優勝可能性
ユーザー k
提出日時 2020-09-03 18:39:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 831 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 198,448 KB
最終ジャッジ日時 2025-01-14 04:15:33
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

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];
  
  REP (i, n) {
    set<int> winner;
    REP (j, m) {
      if (cur[j].empty())
        cur[j].insert(i);
      else {
        int best = r[*cur[j].begin()][j];
        if (r[i][j] == best) {
          cur[j].insert(i);
        } else if (r[i][j] > best) {
          cur[j].clear();
          cur[j].insert(i);
        }
      }
      winner.insert(cur[j].begin(), cur[j].end());
    }
    cout << winner.size() << endl;
  }
  
  return 0;
}
0