結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2020-04-03 21:48:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,196 bytes |
| コンパイル時間 | 1,665 ms |
| コンパイル使用メモリ | 170,452 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-03 02:07:00 |
| 合計ジャッジ時間 | 2,252 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;
vector<string> win={"ooo","--o-","-o--","-oo","oo-","o-o"};
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int Q;cin>>Q;
while(Q--){
int N;string S;cin>>N>>S;
bool ok=false;
for(int i=0;i<N;i++){
for(int j=0;j<6;j++){
bool check=true;
if(i+win[j].size()>=N) continue;
for(int k=0;k<win[j].size();k++){
if(S[i+k]!=win[j][k]) check=false;
}
if(check) ok=true;
}
}
int i=0;
while(i<N){
while(i<N&&S[i]!='o') i++;
if(i>=N) break;
int j=i+1;
while(j<N&&S[j]=='-') j++;
if(j>=N) break;
if(S[j]!='o') break;
if((j-i)%2==0) ok=true;
i=j;
}
if(ok) cout<<"O\n";
else cout<<"X\n";
}
}
Rubikun