結果
問題 | No.709 優勝可能性 |
ユーザー |
|
提出日時 | 2018-10-18 10:02:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,003 bytes |
コンパイル時間 | 782 ms |
コンパイル使用メモリ | 85,144 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-14 17:21:32 |
合計ジャッジ時間 | 6,561 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 10 TLE * 1 -- * 11 |
ソースコード
#include <iostream> #include <vector> #include <map> #include <set> using namespace std; typedef long long LL; int N,M; int GetWinNum(vector<multimap<LL,int,greater<LL>>> &R) { int num=0; set<int> PersonSet; multimap<LL,int,greater<LL>>::iterator mit; for (int j=0;j<M;j++){ mit=R[j].begin(); LL maxV=(*mit).first; for (;mit!=R[j].end();mit++){ if (maxV==(*mit).first){ PersonSet.insert((*mit).second); }else{ break; } } } num=PersonSet.size(); PersonSet.clear(); return num; } int main(int argc, char* argv[]) { cin>>N>>M; vector<multimap<LL,int,greater<LL>>> 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].erase(R[j].begin()); } R[j].insert(multimap<LL,int,greater<LL>>::value_type(r,i+1)); maxR[j]=r; }else if (r==maxR[j]){ R[j].insert(multimap<LL,int,greater<LL>>::value_type(r,i+1)); } } cout<<GetWinNum(R)<<endl; } return 0; }