結果
問題 |
No.1016 三目並べ
|
ユーザー |
|
提出日時 | 2020-04-03 22:07:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 754 bytes |
コンパイル時間 | 1,141 ms |
コンパイル使用メモリ | 68,480 KB |
最終ジャッジ日時 | 2025-01-09 13:03:22 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 WA * 5 |
ソースコード
#include <iostream> #include <string> void solve() { int n; std::string s; std::cin >> n >> s; auto judge = [&]() -> bool { for (int i = 0; i < n; ++i) { if (s.substr(i, 3) == "ooo" || s.substr(i, 4) == "-oo-") { return true; } } return false; }; bool ans = judge(); for (int i = 0; i < n; ++i) { if (s[i] != '-') continue; s[i] = 'o'; if (judge()) 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; }