結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
IKyopro
|
| 提出日時 | 2020-04-03 21:40:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 965 bytes |
| コンパイル時間 | 1,913 ms |
| コンパイル使用メモリ | 193,072 KB |
| 最終ジャッジ日時 | 2025-01-09 12:45:26 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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' && r-l>=3) 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();
}
}
IKyopro