結果

問題 No.1016 三目並べ
ユーザー keserasera_77keserasera_77
提出日時 2020-04-03 22:40:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,446 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 94,224 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 03:41:54
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision


#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

int main() {
	int t;
	cin >> t;

	rep(test, t) {
		int n; cin >> n;
		string s; cin >> s;

		bool ok = false, cntOk = false;
		int cnt = 0;
		rep(i, n) {
			if (s[i] == 'x') cntOk = false;
			if (s[i] == 'o') { cntOk = true; if (cnt & 1) ok = true; cnt = 0; }
			if (cntOk && s[i] == '-') cnt++;
		}

		auto f = [&](string ss) { return s.find(ss) != string::npos; };

		if (f("ooo") || f("-oo") || f("oo-") || f("-o--") || f("--o-") || ok) cout << 'O' << endl;
		else cout << 'X' << endl;
	}
}
0