結果
| 問題 |
No.2283 Prohibit Three Consecutive
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-28 22:21:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 592 bytes |
| コンパイル時間 | 1,340 ms |
| コンパイル使用メモリ | 170,784 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-17 21:16:26 |
| 合計ジャッジ時間 | 1,970 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 6 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const string YES="Yes";
const string NO="No";
/*
s=文字列
S=s+s[0]+s[1]
Sの中に"000","111","00?11","11?00"が含まれていたらNo
*/
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
s=s+s[0]+s[1%n]+s[2%n]+s[3%n];
if(s.find("000")!=string::npos){
cout<<NO<<endl;
}else if(s.find("111")!=string::npos){
cout<<NO<<endl;
}else if(s.find("00?11")!=string::npos){
cout<<NO<<endl;
}else if(s.find("11?00")!=string::npos){
cout<<NO<<endl;
}else{
cout<<YES<<endl;
}
}
return 0;
}