結果
| 問題 | No.1016 三目並べ |
| コンテスト | |
| ユーザー |
zjsdut
|
| 提出日時 | 2025-11-28 00:53:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 872 bytes |
| コンパイル時間 | 1,748 ms |
| コンパイル使用メモリ | 195,504 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-28 00:53:58 |
| 合計ジャッジ時間 | 2,614 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int n;
string s;
cin >> n >> s;
bool win = false;
for (int i = 0; i <= n - 3; i++) {
string t = s.substr(i, 3);
if (t == "ooo" || t == "-oo" || t == "oo-") {
win = true;
break;
}
}
if (!win) {
int last_o = -1;
for (int i = 0; i < n; i++) {
if (s[i] == 'o') {
if (last_o != -1 && (i - last_o) % 2 == 0) {
win = true;
break;
}
last_o = i;
} else if (s[i] == 'x') {
last_o = -1;
}
}
}
cout << "XO"[win] << '\n';
}
}
zjsdut