結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             startcpp
                         | 
                    
| 提出日時 | 2016-03-11 22:27:41 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 460 bytes | 
| コンパイル時間 | 659 ms | 
| コンパイル使用メモリ | 68,828 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-17 07:21:45 | 
| 合計ジャッジ時間 | 1,619 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
#include <iostream>
#include <string>
#include <map>
using namespace std;
int n;
string a[50];
map<string, int> dict;
int main(){
	cin >> n;
	for( int i = 0; i < n; i++ ){
		cin >> a[i];
		if( dict.find(a[i]) == dict.end() ){ dict[a[i]] = 0; }
		dict[a[i]]++;
	}
	for( map<string, int>::iterator it = dict.begin(); it != dict.end(); it++ ){
		if( (*it).second > (n + 1) / 2 ){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}
            
            
            
        
            
startcpp