結果
問題 | No.709 優勝可能性 |
ユーザー |
|
提出日時 | 2018-10-18 10:41:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 891 bytes |
コンパイル時間 | 864 ms |
コンパイル使用メモリ | 81,152 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-15 00:50:59 |
合計ジャッジ時間 | 7,717 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 10 TLE * 1 -- * 11 |
ソースコード
#include <iostream> #include <vector> #include <set> using namespace std; typedef long long LL; int N,M; int GetWinNum(vector<vector<pair<LL,int>>> &R) { int num=0; set<int> PersonSet; for (int j=0;j<M;j++){ LL maxV=R[j][0].first; PersonSet.insert(R[j][0].second); for (int i=1;i<R[j].size();i++){ if (maxV==R[j][i].first){ PersonSet.insert(R[j][i].second); }else{ break; } } } num=(int)PersonSet.size(); PersonSet.clear(); return num; } int main(int argc, char* argv[]) { cin>>N>>M; vector<vector<pair<LL,int>>> R(M); vector<LL> maxR(M,0); int i,j; LL r; for (i=0;i<N;i++){ for (j=0;j<M;j++){ cin>>r; if (r>maxR[j]){ if (R[j].size()>0){ R[j].clear(); } R[j].push_back(pair<LL,int>(r,i+1)); maxR[j]=r; }else if (r==maxR[j]){ R[j].push_back(pair<LL,int>(r,i+1)); } } cout<<GetWinNum(R)<<endl; } return 0; }