結果
問題 | No.349 干支の置き物 |
ユーザー | Elk |
提出日時 | 2018-07-17 21:42:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 2,137 ms |
コンパイル使用メモリ | 175,104 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 08:57:31 |
合計ジャッジ時間 | 2,387 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ map <string, int> mp; int N, flag = 0; string tmp; cin >> N; while(cin >> tmp){ mp[tmp]++; } for(auto itr = mp.begin(); itr != mp.end(); itr++){ if(N%2 == 0){ if(itr->second > N/2){ flag = 1; break; } }else{ if(itr->second > N/2 + 1){ flag = 1; break; } } } if(flag == 1){ cout << "NO" << endl; }else{ cout << "YES" << endl; } return 0; }