結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ixmel
                         | 
                    
| 提出日時 | 2016-04-24 07:10:22 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 802 bytes | 
| コンパイル時間 | 834 ms | 
| コンパイル使用メモリ | 81,644 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-17 07:30:46 | 
| 合計ジャッジ時間 | 1,742 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n;
	cin>>n;
	map<string,int>m;
	rep(i,n){
		string s;
		cin>>s;
		m[s]++;
	}
	int ma=-1;
	for(map<string,int>::iterator it=m.begin();it!=m.end();it++)ma=max(ma,it->second);
	if((n%2&&(n+1)/2<ma)||(n%2==0&&n/2<ma))cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
}
            
            
            
        
            
ixmel