結果

問題 No.1016 三目並べ
ユーザー やむなくやむなく
提出日時 2020-04-03 21:36:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,898 bytes
コンパイル時間 1,506 ms
コンパイル使用メモリ 165,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 00:30:38
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 #

//
// Created by yamunaku on 2020/04/03.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int t;
    cin >> t;
    rep(_, t){
        int n;
        cin >> n;
        string s;
        cin >> s;
        int count = -IINF;
        rep(i, n - 2){
            string tt = s.substr(i, 3);
            if(tt == "oo-" || tt == "o-o" || tt == "-oo" || tt == "ooo"){
                cout << "O" << endl;
                goto next;
            }
        }
        rep(i, n - 4){
            string tt = s.substr(i, 4);
            if(tt == "--o-" || tt == "-o--"){
                cout << "O" << endl;
                goto next;
            }
        }
        rep(i, n){
            if(s[i]=='x'){
                count = -IINF;
            }else if(s[i]=='o'){
                if(count%2){
                    cout << "O" << endl;
                    goto next;
                }
                count = 0;
            }else{
                count++;
            }
        }
        cout << "X" << endl;
        next:;
    }
    return 0;
}
0