結果
問題 |
No.709 優勝可能性
|
ユーザー |
![]() |
提出日時 | 2019-04-24 13:36:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 234 ms / 3,500 ms |
コード長 | 1,432 bytes |
コンパイル時間 | 1,774 ms |
コンパイル使用メモリ | 172,208 KB |
実行使用メモリ | 9,736 KB |
最終ジャッジ日時 | 2024-11-07 19:07:46 |
合計ジャッジ時間 | 6,760 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)<<endl #define p2(s, t) cout << (s) << " " << (t) << endl #define br() p("") #define pn(s) cout << (#s) << " " << (s) << endl const ll mod = 1e9 + 7; const ll inf = 1e18; int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N, M; cin >> N >> M; vector<ll> ma(M); // スキル最高値 vector<vector<ll> > I(M); // スキルごとの最高者のid ll ans = 0; vector<ll> H(N); // 各人の最高値数 FOR(i, 0, N){ bool has_top_skill = false; FOR(j, 0, M){ ll r; cin >> r; if(r>ma[j]){ // スキル更新 ma[j] = r; H[i]++; // 負けた人たち for(ll id : I[j]){ H[id]--; if(H[id]==0){ ans--; } } I[j].resize(0); I[j].push_back(i); has_top_skill = true; } else if(r==ma[j]){ H[i]++; I[j].push_back(i); has_top_skill = true; } } if(has_top_skill){ ans++; } p(ans); } return 0; }