結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 22:43:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,893 bytes |
| コンパイル時間 | 1,720 ms |
| コンパイル使用メモリ | 171,584 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-03 05:06:03 |
| 合計ジャッジ時間 | 3,905 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 10 |
コンパイルメッセージ
main.cpp: In function 'int sub()':
main.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
70 | }
| ^
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll MOD = 1e9 + 7;
const ll INF = 1e10;
const vector<int> dy = {-1,0,1,0};
const vector<int> dx = {0,1,0,-1};
int sub() {
int n;
string s;
cin >> n >> s;
if (n <= 2) {
cout << 'X' << endl;
return 0;
}
rep(i,n - 2) {
if (s[i] == 'o' && s[i + 1] == 'o' && s[i + 2] == 'o') {
cout << 'O' << endl;
return 0;
}
if (s[i] == 'o' && s[i + 1] == '-' && s[i + 2] == 'o') {
cout << 'O' << endl;
return 0;
}
}
rep(i,n - 1) {
if (s[i] == 'o' && s[i + 1] == 'o') {
if (i == 0) {
if (s[i + 2] == 'x') continue;
else {cout << 'O' << endl; return 0;; }
}
if (i == n - 2 ) {
if (s[i - 1] == 'x') continue;
else {cout << 'O' << endl; return 0;}
}
if (s[i - 1] == 'x' && s[i + 2] == 'x') continue;
else {cout << 'O' << endl; return 0;}
}
}
int cnt_ = 0;
int cnto = 0;
int idxx;
int idxo;
rep(i,n) {
if (s[i] == 'x') {
if (cnt_ + cnto == 4) {
if (cnto == 1 && ((idxo + 2 == i) || (idxo + 3 == i))) {
cout << 'O' << endl;;
return 0;
}
}
if (cnt_ + cnto >= 5) {
if (idxo + 1 == i || idxo + cnt_ + cnto == i) {
continue;
}
else {
cout << 'O' << endl;
return 0;
}
}
}
}
cout << 'X' << endl;
}
int main() {
int t; cin >> t;
rep(_,t) {
sub();
}
}