結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 8 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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<N;)
		{
			if(s[i]!='o')
			{
				i++;
				continue;
			}
			int j=i+1;
			while(j<N&&s[j]=='-')j++;
			if(j<N&&s[j]=='o'&&(j-i)%2==0)flag=true;
			i=j;
		}
		cout<<(flag?"O":"X")<<endl;
	}
}
0