結果
| 問題 |
No.1016 三目並べ
|
| ユーザー |
ferin
|
| 提出日時 | 2020-04-03 21:52:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,429 bytes |
| コンパイル時間 | 6,528 ms |
| コンパイル使用メモリ | 193,272 KB |
| 最終ジャッジ日時 | 2025-01-09 12:53:47 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;
void solve() {
ll n;
string s;
cin >> n >> s;
REP(i, n-2) {
string str = s.substr(i, 3);
if(str == "ooo" || str == "oo-" || str == "-oo") {
cout << "O\n";
return;
}
}
REP(i, n-3) {
string str = s.substr(i, 4);
if(str == "-o--" || str == "--o-") {
cout << "O\n";
return;
}
}
ll con = 0;
bool ok = false;
REP(i, n) {
if(s[i]=='o') {
if(ok) {
if(con%2) {
cout << "O\n";
return;
}
}
ok = true;
} else if(s[i]=='-') {
if(ok) con++;
} else if(s[i]=='x') {
ok = false;
}
}
cout << "X\n";
}
int main(void) {
ll t;
cin >> t;
while(t--) solve();
return 0;
}
ferin