結果
問題 |
No.1016 三目並べ
|
ユーザー |
![]() |
提出日時 | 2020-04-03 22:15:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,339 bytes |
コンパイル時間 | 1,132 ms |
コンパイル使用メモリ | 116,832 KB |
最終ジャッジ日時 | 2025-01-09 13:06:13 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 4 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; constexpr int inf=1e9+7; constexpr ll longinf=1LL<<60 ; constexpr ll mod=1e9+7 ; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int t; cin>>t; while(t--){ int n; cin>>n; string s; cin>>s; bool win=false; rep(i,n-2){ if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='o')win=true; if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='-')win=true; if(s[i]=='o'&&s[i+1]=='-'&&s[i+2]=='o')win=true; if(s[i]=='-'&&s[i+1]=='o'&&s[i+2]=='o')win=true; } rep(i,n-3){ if(s[i]=='-'&&s[i+1]=='-'&&s[i+2]=='o'&&s[i+3]=='-')win=true; if(s[i]=='-'&&s[i+1]=='o'&&s[i+2]=='-'&&s[i+3]=='-')win=true; } rep(i,n-4){ if(s[i]=='o'&&s[i+1]=='-'&&s[i+2]=='-'&&s[i+3]=='-'&&s[i+4]=='o')win=true; } if(win)cout<<"O"<<endl; else cout<<"X"<<endl; } return 0; }