結果
問題 |
No.709 優勝可能性
|
ユーザー |
|
提出日時 | 2020-09-03 18:44:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 634 ms / 3,500 ms |
コード長 | 985 bytes |
コンパイル時間 | 2,071 ms |
コンパイル使用メモリ | 206,708 KB |
最終ジャッジ日時 | 2025-01-14 04:15:49 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#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; }