結果
| 問題 |
No.349 干支の置き物
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-23 23:58:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 531 bytes |
| コンパイル時間 | 1,657 ms |
| コンパイル使用メモリ | 174,196 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 15:49:36 |
| 合計ジャッジ時間 | 2,475 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:9: warning: 't' may be used uninitialized [-Wmaybe-uninitialized]
25 | if(t <= (n + 1) / 2)cout << "YES" << endl;
| ^~
main.cpp:21:13: note: 't' was declared here
21 | int t;
| ^
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define SZ(n) (int)(n).size()
#define ALL(n) (n).begin(), (n).end()
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef vector<int> VI;
int main() {
int n;
cin >> n;
map<string, int> a;
REP(i, n) {
string s;
cin >> s;
a[s]++;
}
int t;
for (auto& i : a) {
t = max(t, i.second);
}
if(t <= (n + 1) / 2)cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}