結果
| 問題 | 
                            No.2283 Prohibit Three Consecutive
                             | 
                    
| コンテスト | |
| ユーザー | 
                             yukster714
                         | 
                    
| 提出日時 | 2023-04-28 21:59:09 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 583 bytes | 
| コンパイル時間 | 1,540 ms | 
| コンパイル使用メモリ | 169,096 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-17 20:57:53 | 
| 合計ジャッジ時間 | 2,193 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 3 WA * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define yesif(x) cout << ((x) ? "Yes": "No") << endl 
bool eq(char a, char b){
    return (a == b or a == '?' or b == '?');
}
bool eq(char a, char b, char c){
    return eq(a,b) and eq(b, c);
}
bool solve(int n, string s){
    rep(i,n){
        if(!eq(s[i%n], s[(i+1)%n], s[(i+2)%n])){
            return false;
        }
    }
    return true;
}
int main() {
    int t; cin>>t;
    while(t--){
        int n; cin >> n;
        string s; cin>> s;
        yesif(solve(n,s));
    }
    return 0;
}
            
            
            
        
            
yukster714