結果
問題 |
No.1016 三目並べ
|
ユーザー |
|
提出日時 | 2020-04-03 22:25:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 898 bytes |
コンパイル時間 | 798 ms |
コンパイル使用メモリ | 66,404 KB |
最終ジャッジ日時 | 2025-01-09 13:12:15 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 WA * 7 |
ソースコード
#include <iostream> #include <string> void solve() { int n; std::cin >> n; int len = 0, c1 = -1, c2 = -1; bool ans = false; while (n--) { char c; std::cin >> c; if (c == 'x') { len = 0; c1 = c2 = -1; } else { ++len; 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::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; }