結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-06-24 23:31:15 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 528 bytes | 
| コンパイル時間 | 1,676 ms | 
| コンパイル使用メモリ | 176,148 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-03 20:26:44 | 
| 合計ジャッジ時間 | 2,578 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:23:20: warning: init-statement in selection statements only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   23 |                 if(auto itr=mp.find(s); itr!=end(mp)){
      |                    ^~~~
main.cpp:29:24: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   29 |         for(const auto&[key,value]:mp){
      |                        ^
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
	map<string, int> mp{
		{"ne",0},
		{"ushi",0},
		{"tora",0},
		{"u",0},
		{"tatsu",0},
		{"mi",0},
		{"uma",0},
		{"hitsuji",0},
		{"saru",0},
		{"tori",0},
		{"inu",0},
		{"i",0}
	};
	int n; cin>>n;
	rep(i,n){
		string s; cin>>s;
		if(auto itr=mp.find(s); itr!=end(mp)){
			itr->second++;
		}
	}
  if(n%2!=0) n++;
	bool flg=true;
	for(const auto&[key,value]:mp){
		if(value>n/2) flg=false;
	}
	cout<<(flg?"YES":"NO")<<endl;
}