結果

問題 No.1016 三目並べ
ユーザー kyoprounokyoprouno
提出日時 2020-04-03 23:03:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,437 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 174,556 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 04:16:59
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9;


int main()
{
    ll t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        string s;
        cin >> s;
        bool ok=false;
        rep(i,n){
            if(i<=n-3){
                bool ok1=true;
                string p1="ooo";
                rep(k,3){
                    if(s[i+k]!=p1[k]){
                        ok1=false;
                        break;
                    }
                }
                if(ok1) ok=true;
                bool ok2=true;
                string p2="o-o";
                rep(k,3){
                    if(s[i+k]!=p2[k]){
                        ok2=false;
                        break;
                    }
                }
                if(ok2) ok=true;
                bool ok3=true;
                string p3="oo-";
                rep(k,3){
                    if(s[i+k]!=p3[k]){
                        ok3=false;
                        break;
                    }
                }
                if(ok3) ok=true;
                bool ok4=true;
                string p4="-oo";
                rep(k,3){
                    if(s[i+k]!=p4[k]){
                        ok4=false;
                        break;
                    }
                }
                if(ok4) ok=true;
            }
            if(i<=n-4){
                bool ok5=true;
                string p5="--o-";
                rep(k,4){
                    if(s[i+k]!=p5[k]){
                        ok5=false;
                        break;
                    }
                }
                if(ok5) ok=true;
                bool ok6=true;
                string p6="-o--";
                rep(k,4){
                    if(s[i+k]!=p6[k]){
                        ok6=false;
                        break;
                    }
                }
                if(ok6) ok=true;
            }
        }
        if(ok) cout << "O" << endl;
        else cout << "X" << endl;
    }
    return 0;
} 
0