結果
| 問題 |
No.1016 三目並べ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-03 21:48:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 590 ms |
| コンパイル使用メモリ | 66,224 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-03 02:03:41 |
| 合計ジャッジ時間 | 1,073 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int T,N;
string s;
main()
{
cin>>T;
for(;T--;)
{
cin>>N>>s;
bool flag=false;
for(int i=0;i+3<=N;i++)
{
if(s.substr(i,3)=="ooo"||s.substr(i,3)=="-oo"||s.substr(i,3)=="oo-")flag=true;
}
for(int i=0;i+4<=N;i++)
{
if(s.substr(i,4)=="-o--"||s.substr(i,4)=="--o-")flag=true;
}
for(int i=0;i<N;i++)
{
if(s[i]!='o')continue;
int j=i+1;
while(j<N&&s[j]!='x')
{
if(s[j]=='o'&&(j-i)%2==0)flag=true;
j++;
}
}
cout<<(flag?"O":"X")<<endl;
}
}