結果
| 問題 |
No.349 干支の置き物
|
| コンテスト | |
| ユーザー |
soupesuteaka
|
| 提出日時 | 2017-05-01 10:28:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,155 bytes |
| コンパイル時間 | 819 ms |
| コンパイル使用メモリ | 81,748 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 01:48:09 |
| 合計ジャッジ時間 | 1,855 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
// macros
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define LLINF 1000000000000000000LL
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define debug(a) cout << "L(" << __LINE__ << "):" << #a << ":" << a << endl;
// problems limits
#define MAX_N 100
// Variables
int N;
vector<string> eto;
// problems input
void input()
{
cin >> N;
FOR(i,0,N) {
string s;
cin >> s;
eto.push_back(s);
}
}
// problems main
void solve()
{
map<string, int> ecnt;
FOR(i,0,N) {
ecnt[eto[i]]++;
}
vector<int> v;
for(map<string,int>::iterator ite=ecnt.begin(); ite!=ecnt.end();ite++) {
v.push_back(ite->second);
}
sort(v.begin(),v.end(), greater<int>());
int lc = 0;
FOR(i,1,v.size()) {
lc += v[i];
}
if (v.size() == 1 || v[0]-2>=lc) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
input();
solve();
}
soupesuteaka