結果
問題 |
No.349 干支の置き物
|
ユーザー |
![]() |
提出日時 | 2016-05-14 14:56:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 1,433 ms |
コンパイル使用メモリ | 162,696 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-06 02:31:58 |
合計ジャッジ時間 | 8,201 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | WA * 1 RE * 2 TLE * 1 -- * 25 |
ソースコード
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) using namespace std; int main(){ string s[] = {"ne","ushi","tora","u","tatsu","mi","uma", "hitsuji","saru","tori","inu","i"} , str[50]; int n,ar[12]={}; cin>>n; rep(i,0,n){ cin>>str[i]; } rep(i,0,n){ rep(j,0,12){ if(str[i] == s[j]){ ar[j]++; } } } sort(ar,ar+n); int tmp = -1; bool f; rep(i,0,n){ for(int j=11; 0<=j; j--){ f = false; if(j != tmp && ar[j]!=0){ ar[j]--; tmp = j; f = true; break; } } if(!f){ cout<<"NO"<<endl; return 0; } } cout<<"YES"<<endl; return 0; }