結果
問題 |
No.1016 三目並べ
|
ユーザー |
|
提出日時 | 2020-04-03 21:54:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,043 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 168,672 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 02:21:12 |
合計ジャッジ時間 | 2,258 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define range(a) a.begin(), a.end() int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); int T; cin >> T; while (T--) { int N; cin >> N; string S; cin >> S; S = "xxxxx" + S + "xxxxx"; N = S.size(); bool ans = false; ans |= S.find("ooo") != string::npos; ans |= S.find("o-o") != string::npos; ans |= S.find("oo-") != string::npos; ans |= S.find("-oo") != string::npos; int i = 0; while (i < N) { if (S[i] != 'o') { i++; continue; } int cnt = 0; while (S[i] == '-') { i++; cnt++; } if (S[i] == 'x') { continue; } while ((cnt - 1) % 2 == 0) { cnt = (cnt - 1) / 2; } if (cnt == 1) { ans = true; } i++; } cout << (ans ? "O" : "X") << '\n'; } }