結果

問題 No.1016 三目並べ
ユーザー kotatsugamekotatsugame
提出日時 2020-04-03 21:47:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 66,320 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 00:56:40
合計ジャッジ時間 1,255 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#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;
			}
		}
		cout<<(flag?"O":"X")<<endl;
	}
}
0