Submission #00082
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <bits/stdc++.h> #define endl "\n" #define INF INT_MAX using namespace std; bool check( char c,string s){ bool f = 0; for ( int i = 0;i < s.size();i++){ if (s[i] == c)f = 1; } return f; } int main(){ #define int long long cin.tie(nullptr);ios::sync_with_stdio( false ); int n; cin >>n; map< int , int >a; for ( int i = 0;i < n;i++){ int x; cin >>x; a[x]++; } int Max = 0; vector< int >ans; for (auto itr = a.begin();itr != a.end();itr++){ if (Max < itr->second){ Max = itr->second; ans.clear(); ans.push_back(itr->first); } else if (Max == itr->second)ans.push_back(itr->first); } for ( int i = 0;i < ans.size();i++){ cout <<ans[i]<<endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0011 - 強欲な壺 |
ユーザー名 | ei2332 |
投稿日時 | 2023-11-13 16:56:58 |
言語 | C++17 |
状態 | Accepted |
得点 | 50 |
ソースコード長 | 716 Byte |
最大実行時間 | 62 ms |
最大メモリ使用量 | 7464 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 50 / 50 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in-01.txt | AC | 21 ms | 348 KB |
1
|
in-02.txt | AC | 16 ms | 436 KB |
1
|
in-03.txt | AC | 24 ms | 520 KB |
1
|
in-04.txt | AC | 25 ms | 476 KB |
1
|
in-05.txt | AC | 59 ms | 6956 KB |
1
|
in-06.txt | AC | 30 ms | 2848 KB |
1
|
in-07.txt | AC | 62 ms | 7464 KB |
1
|
in-08.txt | AC | 22 ms | 1528 KB |
1
|
in-09.txt | AC | 53 ms | 5476 KB |
1
|
in-10.txt | AC | 55 ms | 7088 KB |
1
|