結果
問題 |
No.1016 三目並べ
|
ユーザー |
![]() |
提出日時 | 2020-04-03 22:25:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,328 bytes |
コンパイル時間 | 734 ms |
コンパイル使用メモリ | 84,044 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 04:21:07 |
合計ジャッジ時間 | 1,262 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <set> #include <map> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int T; cin >> T; for(int _ = 0; _ < T; _++){ int N; string S; cin >> N >> S; bool ok = false; for(int i = 0; i+2 < N; i++){ if(S[i] == 'o' && S[i+1] == 'o' && S[i+2] == '-') ok = true; if(S[i] == '-' && S[i+1] == 'o' && S[i+2] == 'o') ok = true; if(S[i] == 'o' && S[i+1] == '-' && S[i+2] == 'o') ok = true; if(S[i] == 'o' && S[i+1] == 'o' && S[i+2] == 'o') ok = true; } for(int i = 0; i+3 < N; i++){ if(S[i] == '-' && S[i+1] == 'o' && S[i+2] == '-' && S[i+3] == '-') ok = true; if(S[i] == '-' && S[i+1] == '-' && S[i+2] == 'o' && S[i+3] == '-') ok = true; } int cnto = 0; int cnt_ = 0; for(int i = 0; i < N; i++){ if(S[i] == 'x') cnt_ = 0; if(S[i] == '-') cnt_++; if(S[i] == 'o'){ if(cnt_%2 == 1)ok = true; cnt_ = 0; } } if(ok) cout << 'O' << endl; else cout << 'X' << endl; } }