結果

問題 No.1016 三目並べ
ユーザー ferinferin
提出日時 2020-04-03 21:52:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,429 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 199,008 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-16 01:11:27
合計ジャッジ時間 2,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

void solve() {
    ll n;
    string s;
    cin >> n >> s;

    REP(i, n-2) {
        string str = s.substr(i, 3);
        if(str == "ooo" || str == "oo-" || str == "-oo") {
            cout << "O\n";
            return;
        }
    }
    REP(i, n-3) {
        string str = s.substr(i, 4);
        if(str == "-o--" || str == "--o-") {
            cout << "O\n";
            return;
        }
    }
    ll con = 0;
    bool ok = false;
    REP(i, n) {
        if(s[i]=='o') {
            if(ok) {
                if(con%2) {
                    cout << "O\n";
                    return;
                }
            }
            ok = true;
        } else if(s[i]=='-') {
            if(ok) con++;
        } else if(s[i]=='x') {
            ok = false;
        }
    }
    cout << "X\n";
}

int main(void) {
    ll t;
    cin >> t;
    while(t--) solve();

    return 0;
}
0