結果

問題 No.1016 三目並べ
ユーザー veqcc
提出日時 2020-04-06 18:27:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 103,796 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 15:17:39
合計ジャッジ時間 1,492 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;

    while (t--) {
        int n;
        string s;
        cin >> n >> s;

        bool win = false;

        for (int i = 0; i < n - 2; i++) {
            string str = s.substr(i, 3);
            if (str == "ooo") win = true;
            if (str == "o-o") win = true;
            if (str == "oo-") win = true;
            if (str == "-oo") win = true;
        }

        for (int i = 0; i < n - 4; i++) {
            string str = s.substr(i, 5);
            if (str == "o-o-o") win = true;
        }

        cout << (win ? 'O' : 'X') << endl;
    }

    return 0;
}
0