結果

問題 No.1016 三目並べ
ユーザー hirono999hirono999
提出日時 2020-04-03 23:19:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,129 bytes
コンパイル時間 1,454 ms
コンパイル使用メモリ 165,044 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 04:50:34
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll T;
    cin >> T;
    rep(_, T){
        ll N;
        cin >> N;
        string S;
        cin >> S;
        bool flag = true;
        rep(i, N - 2){
            if(S[i] == 'o' and S[i + 1] == 'o' and S[i + 2] == 'o') flag = false;
            if(S[i] == '-' and S[i + 1] == 'o' and S[i + 2] == '-') flag = false;
            if(S[i] == 'o' and S[i + 1] == '-' and S[i + 2] == 'o') flag = false;
            if(S[i] == 'o' and S[i + 1] == 'o' and S[i + 2] != 'x') flag = false;
            if(S[i] != 'x' and S[i + 1] == 'o' and S[i + 2] == 'o') flag = false;
        }
        bool m = false;
        ll ct = 0;
        rep(i, N){
            if(S[i] == 'o') m = true;
            if(m){
                if(S[i] == '-') ++ct;
                if(S[i] == 'x'){
                    ct = 0;
                    m = false;
                }
                if(S[i] == 'o'){
                    if(ct > 0 and (ct % 2 == 1 or ct >= 6) ) flag = false;
                    ct = 0;
                }   
            }
        }

        if(flag) print("X");
        else print("O");
    }

    return 0;
}
0