結果

問題 No.1016 三目並べ
ユーザー hiroaki0615hiroaki0615
提出日時 2020-04-03 22:22:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,313 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 68,828 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 02:38:12
合計ジャッジ時間 1,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

void solve() {
    int N;
    string S;
    cin >> N >> S;
    if (N < 3) {
        cout << 'X' << endl;
        return;
    }
    rep(i, 0, N - 2) {
        if (S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == 'o') {
            cout << 'O' << endl;
            return;
        }
        if (S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == '-') {
            cout << 'O' << endl;
            return;
        }
        if (S[i] == '-' && S[i + 1] == 'o' && S[i + 2] == 'o') {
            cout << 'O' << endl;
            return;
        }
        if (S[i] == 'o' && S[i + 1] == '-' && S[i + 2] == 'o') {
            cout << 'O' << endl;
            return;
        }
    }
    cout << "X" << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int T;
    cin >> T;
    rep(_, 0, T) {
        solve();
    }
    return 0;
}
0