結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2020-04-03 21:45:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 915 bytes |
| コンパイル時間 | 1,730 ms |
| コンパイル使用メモリ | 172,308 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-03 01:56:31 |
| 合計ジャッジ時間 | 2,417 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
vector<char> ans;
signed main(){
int t;cin>>t;
while(t--){
bool ok=0;
int n;string s;cin>>n>>s;
if(n<3){ans.push_back('X');continue;}
int cnt=0;
for(int i=0;i<n;i++){
if(s[i]=='o'){
if(++cnt>=3)ok=1;
}
else cnt=0;
}
if(ok){ans.push_back('O');continue;}
for(int i=0;i<n-2;i++)if(s.substr(i,3)=="oo-"||s.substr(i,3)=="o-o"||s.substr(i,3)=="-oo")ok=1;
if(ok){ans.push_back('O');continue;}
int start=0,odd=0;
for(int i=1;i<n;i++){
if(s[i]=='-'&&(!start)&&s[i-1]=='o'){
start=1;
odd=1;
continue;
}
if(s[i]=='-'&&start)odd^=1;
if(s[i]=='o'&&start){
if(odd)ok=1;
start=0;
}
if(s[i]=='x'&&start){
start=0;
}
}
if(ok)ans.push_back('O');
else ans.push_back('X');
}
for(char p:ans)cout<<p<<endl;
}
cureskol