結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-06-02 03:36:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 1,781 ms |
コンパイル使用メモリ | 175,420 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:34:31 |
合計ジャッジ時間 | 2,803 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; map<string, int> cnt; for (int i = 0; i < N; i++) { string s; cin >> s; cnt[s]++; } bool poss = 1; for (auto &x: cnt) { if (N % 2 == 0 && x.second > N/2) { poss = 0; } if (N % 2 == 1 && x.second > N/2+1) { poss = 0; } } cout << (poss ? "YES" : "NO") << endl; return 0; }