結果
問題 |
No.2283 Prohibit Three Consecutive
|
ユーザー |
![]() |
提出日時 | 2023-04-28 22:00:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 1,274 ms |
コンパイル使用メモリ | 167,652 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 20:59:24 |
合計ジャッジ時間 | 1,861 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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) and eq(c, a); } 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; }