結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-05 20:42:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 730 bytes |
| コンパイル時間 | 2,006 ms |
| コンパイル使用メモリ | 194,784 KB |
| 最終ジャッジ日時 | 2025-01-09 14:24:04 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 WA * 5 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false); cin.tie(0);
auto solve = [] () {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 0; i + 2 < n; i++) {
if (s.substr(i, 3) == "ooo") return "O\n";
}
for (int i = 0; i < n; i++) {
if (s[i] == '-') {
s[i] = 'o';
for (int j = max(0, i - 2); j <= i; j++) {
if (s.substr(j, 3) == "ooo") return "O\n";
}
for (int j = max(0, i - 3); j <= i; j++) {
if (s.substr(j, 4) == "-oo-") return "O\n";
}
s[i] = '-';
}
}
return "X\n";
};
int t;
cin >> t;
while (t--) cout << solve();
return 0;
}