結果
問題 |
No.349 干支の置き物
|
ユーザー |
![]() |
提出日時 | 2016-03-11 22:54:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 72,916 KB |
実行使用メモリ | 17,080 KB |
最終ジャッジ日時 | 2024-09-25 01:08:37 |
合計ジャッジ時間 | 7,126 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 28 |
ソースコード
#include <iostream> #include <cmath> #include <map> using namespace std; int main(){ int elsenum,maxnum = 0,n; cin >> n; map<string,int> m; for(int i = 0;i < n;i++){ string s; cin >> s; m[s]++; maxnum = max(maxnum,m[s]); } for(auto itr = m.begin();itr != m.end();itr++){ elsenum = 0; for(auto itr2 = m.begin();itr != m.end();itr2++){ if(itr == itr2) continue; else elsenum += itr2->second; } if(maxnum - 1 > elsenum){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; }