結果
問題 | No.1016 三目並べ |
ユーザー |
![]() |
提出日時 | 2020-04-03 21:46:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,131 bytes |
コンパイル時間 | 1,765 ms |
コンパイル使用メモリ | 193,992 KB |
最終ジャッジ日時 | 2025-01-09 12:48:01 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 WA * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> using Pa = pair<T, U>; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; void solve(){ int N; cin >> N; string S; cin >> S; if(N<=2){ cout << "X\n"; return ; } int l = 0; bool ok = false; while(l<N){ int r = l; while(r<N && S[l]==S[r]) r++; if(S[l]=='o'){ if(r-l>=3) ok = true; if(r-l==1){ if(2<=l && r+1<N && S[l-1]=='-' && S[l-2]== '-' && S[r]=='-' && S[r+1]=='-') ok = true; } } if(S[l]=='-'){ if(l>=2 && S[l-1]=='o' && S[l-2]=='o') ok = true; if(r+1<N && S[r]=='o' && S[r+1]=='o') ok = true; if(l>=1 && r<N && S[l-1]=='o' && S[r]=='o'){ int len = r-l; if(len%2) ok = true; } } l = r; } cout << (ok? "O\n":"X\n"); } int main(){ cin.tie(0); ios::sync_with_stdio(false); int T; cin >> T; while(T--){ solve(); } }