結果

問題 No.349 干支の置き物
ユーザー pirozhki
提出日時 2018-06-02 21:47:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 65,996 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 09:08:46
合計ジャッジ時間 1,520 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	vector<string> v;

	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		v.emplace_back(s);
	}

	for (const string& s : v) {
		if (count(v.begin(), v.end(), s) > (v.size() + 1) / 2) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;

	return 0;
}
0