結果

問題 No.349 干支の置き物
ユーザー mmn15277198
提出日時 2020-11-01 22:08:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 101,912 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 05:52:19
合計ジャッジ時間 2,012 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
#include<set>

#define rep(i,n) for(int (i) = 0; i < (n); i++)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

const ll mod = 998244353;

int main(){ 
	int n;
	cin >> n;
	map<string , int> cnt;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		cnt[s]++;
	}
	int h;
	if(n % 2)h = (n + 1)/2;
	else h = n/2;
	for(auto i : cnt){
		if(i.second > h){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;    
}
0