結果
問題 | No.349 干支の置き物 |
ユーザー | ldsyb |
提出日時 | 2016-03-11 22:55:03 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 792 ms |
コンパイル使用メモリ | 72,652 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:23:19 |
合計ジャッジ時間 | 1,654 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#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();itr2 != m.end();itr2++){ if(itr == itr2) continue; else elsenum += itr2->second; } if(maxnum - 1 > elsenum){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; }