結果
| 問題 | No.1016 三目並べ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 22:10:09 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 853 bytes |
| 記録 | |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 84,808 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-06-09 07:15:59 |
| 合計ジャッジ時間 | 1,295 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 WA * 4 |
ソースコード
#include <iostream>
#include <string>
void solve() {
int n;
std::string s;
std::cin >> n >> s;
auto judge = [&](int l, int r) -> bool {
for (int i = std::max(0, l); i < std::min(n, r); ++i) {
if (s.substr(i, 3) == "ooo" ||
s.substr(i, 4) == "-oo-" ||
s.substr(i, 5) == "o-o-o") {
return true;
}
}
return false;
};
bool ans = judge(0, n);
for (int i = 0; i < n; ++i) {
if (s[i] != '-') continue;
s[i] = 'o';
if (judge(i - 5, i + 5)) ans = true;
s[i] = '-';
}
std::cout << (ans ? 'O' : 'X') << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::cout.tie(nullptr);
std::ios::sync_with_stdio(false);
int q;
std::cin >> q;
while (q--) solve();
return 0;
}