結果
問題 | No.2148 ひとりUNO |
ユーザー |
![]() |
提出日時 | 2022-12-05 10:13:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,086 bytes |
コンパイル時間 | 2,294 ms |
コンパイル使用メモリ | 209,960 KB |
最終ジャッジ日時 | 2025-02-09 05:22:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 WA * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; using lint=long long; #define rep(i,n) for(int i=0;i<int(n);++i) #define all(n) (n).begin(),(n).end() void solve(){ lint n; cin>>n; vector<string>s(n); vector<lint>cnt(3); rep(i,n){ char c; lint j; cin>>c>>j; j--; s[j]+=c; string t="BRG"; rep(k,3){ if(t[k]==c){ cnt[k]++; } } } rep(i,n)sort(all(s[i])); sort(all(s)); lint p=count(all(s),"GR"); lint q=count(all(s),"BG"); lint r=count(all(s),"BR"); if((p&&q)||(q&&r)||(r&&p)){ cout<<"YES"<<endl; }else if((p||q||r)&&count(all(s),"BGR")){ cout<<"YES"<<endl; }else if(count(all(s),"BGR")&&*min_element(all(cnt))==1){ cout<<"YES"<<endl; }else if((p&&cnt[0]==0)||(q&&cnt[1]==0)||(r&&cnt[2]==0)){ cout<<"YES"<<endl; }else if((cnt[0]==n)||(cnt[1]==n)||(cnt[2]==n)){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } } int main(){ int t; cin>>t; while(t--)solve(); }