結果
| 問題 |
No.2343 (l+r)/2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-10 00:24:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,080 bytes |
| コンパイル時間 | 1,958 ms |
| コンパイル使用メモリ | 208,352 KB |
| 最終ジャッジ日時 | 2025-02-14 01:09:05 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
map<vector<int>,bool> mp={
{{0,0,0},0},
{{0,0,1},1},
{{0,1,0},0},
{{0,1,1},1},
{{1,0,0},1},
{{1,0,1},0},
{{1,1,0},1},
{{1,1,1},0},
{{0,0,0,0},0},
{{0,0,0,1},1},
{{0,0,1,0},0},
{{0,0,1,1},1},
{{0,1,0,0},0},
{{0,1,0,1},1},
{{0,1,1,0},1},
{{0,1,1,1},1},
{{1,0,0,0},1},
{{1,0,0,1},1},
{{1,0,1,0},1},
{{1,0,1,1},0},
{{1,1,0,0},1},
{{1,1,0,1},0},
{{1,1,1,0},1},
{{1,1,1,1},0},
};
void solve(){
int n;
cin>>n;
vector<int> a(n);
rep(i,n) cin>>a.at(i);
int ct=0;
rep(i,n) if(a.at(i)) ct++;
if(ct>=4){
cout<<"Yes\n";
return;
}
while(a.size()>4){
int ba=*a.rbegin();
int ba2=*(a.rbegin()+1);
int ba3=*(a.rbegin()+2);
if(ba==ba2) a.pop_back();
else{
if(ba2==ba3){
cout<<"Yes\n";
return;
}
a.pop_back();
a.pop_back();
}
}
if(mp[a]) cout<<"Yes\n";
else cout<<"No\n";
}
int main(){
int t;
cin>>t;
rep(i,t){
solve();
}
}