結果
問題 |
No.1016 三目並べ
|
ユーザー |
|
提出日時 | 2020-04-03 22:29:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 1,956 ms |
コンパイル使用メモリ | 71,500 KB |
最終ジャッジ日時 | 2025-01-09 13:15:46 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 WA * 7 |
ソースコード
#include <iostream> #include <algorithm> #include <string> void solve() { int n; std::string s; std::cin >> n >> s; bool ans = false; for (int i = 0; i < 2; ++i) { int c1 = -1, c2 = -1; for (auto c : s) { if (c == 'x') { c1 = c2 = -1; } else { int c0 = (c == 'o'); if ((c1 == 1 && c2 == 1) || (c0 == 1 && c2 == 1) || (c0 == 1 && c1 == 1 && c2 != -1)) { ans = true; } if (c2 == 1) { c0 = 1; c1 = -1; } c2 = c1; c1 = c0; } } std::reverse(s.begin(), s.end()); } 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; }