結果

問題 No.1016 三目並べ
ユーザー hedwig100
提出日時 2020-04-03 22:03:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 1,861 ms
コンパイル使用メモリ 168,408 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-03 02:49:27
合計ジャッジ時間 2,176 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll MOD = 1e9 + 7;
const ll INF = 1e10;
const vector<int> dy = {-1,0,1,0};
const vector<int> dx = {0,1,0,-1};

int main() {
    int t; cin >> t;
    rep(_,t) {
        int n;
        string s;
        cin >> n >> s;
        if (n <= 2) {
            cout << 'X' << endl;
            return 0;
        }
        char ans = 'X';
        rep(i,n - 1) {
            if (s[i] == 'o' && s[i + 1] == 'o') {
                if (i == 0 && s[i + 2] == 'x' ) continue;
                if (i == n - 2 && s[i - 1] == 'x') continue;
                if (s[i - 1] == 'x' && s[i + 2] == 'x') continue;
                else {ans = 'O'; break;}
            }
            
        }
        cout << ans << endl;
    }
}
0