結果

問題 No.1016 三目並べ
ユーザー okok
提出日時 2020-04-03 22:35:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 78,304 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-16 03:26:40
合計ジャッジ時間 1,378 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
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 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

bool solve(string &S){
	int N = S.size();
	
	for(int i = 0; i < N - 2; i++){
		string x;
		
		x += S[i];
		x += S[i+1];
		x += S[i+2];
		
		if(x == "ooo") return true;
		if(x == "oo-") return true;
		if(x == "o-o") return true;
		if(x == "-oo") return true;
	}
	
	return false;
}

signed main(){
	cout<<fixed<<setprecision(10);
	
	int T;
	
	cin>>T;
	
	for(int _ = 0; _ < T; _++){
		int N;
		string S;
		
		cin>>N>>S;
		
		if(solve(S)) cout<<"o"<<endl;
		else cout<<"x"<<endl;
	}
	
	
	return 0;
}
0