結果
問題 |
No.349 干支の置き物
|
ユーザー |
![]() |
提出日時 | 2016-05-14 14:59:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 1,678 ms |
コンパイル使用メモリ | 172,904 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-06 02:32:13 |
合計ジャッジ時間 | 8,187 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | WA * 1 RE * 8 TLE * 1 -- * 19 |
ソースコード
#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; }