結果
問題 |
No.1016 三目並べ
|
ユーザー |
|
提出日時 | 2020-04-03 22:37:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,146 bytes |
コンパイル時間 | 1,744 ms |
コンパイル使用メモリ | 167,676 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 04:52:19 |
合計ジャッジ時間 | 2,260 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pp; const ll INF = 1e18; const int MOD = 1000000007; #define rep(i,n) for(int i=0;i<n;i++) bool solve(int n,string s){ rep(i,n-2){ if(s[i] == '-' && s[i+1] == 'o' && s[i+2] == 'o'){ return true; }if(s[i] == 'o' && s[i+1] == 'o' && s[i+2] == '-'){ return true; }if(s[i] == 'o' && s[i+1] == 'o' && s[i+2] == 'o'){ return true; } }rep(i,n-4){ if(s[i] == 'o' && s[i+1] == '-' && s[i+2] == '-' && s[i+3] == '-' && s[i+4] == 'o'){ return true; }if(s[i] == 'o' && s[i+1] == '-' && s[i+2] == '-' && s[i+3] == 'o' && s[i+4] == '-'){ return true; } } return false; } int main(){ int t; cin >> t; while(t--){ int n; string s; cin >> n >> s; cout << (solve(n,s) ? 'O' : 'X') << endl; } return 0; }