結果

問題 No.486 3 Straight Win(3連勝)
ユーザー uxux
提出日時 2022-12-02 01:45:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,852 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 206,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 12:27:50
合計ジャッジ時間 3,204 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>    //atcoder用
//using namespace atcoder;  //atcoder用
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using Graph = vector<vector<int>>;
//using pri = priority_queue<int>;  //最大値
//using pri = priority_queue<int, vector<int>, greater<int>>;   //最小値
#define _GLIBCXX_DEBUG
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(f,c,... ) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
const int INF = 1e9;
const int MININF = -1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const int MODD = 998244353;

// 4方向
vi vx={0,1,0,-1};
vi vy={1,0,-1,0};


// a<bならaをbに更新
template <typename T>
bool chmax(T &a, const T& b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

// a>bならaをbに更新
template <typename T>
bool chmin(T &a, const T& b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}


// 素数判定
bool prime(ll N){
    if(N==1)return false;
    for (ll i=2;i*i<=N;i++){
        if (N%i == 0)return false;
    }
    return true;
}

// 約数列挙
vl factor(int X){
    vl ans;
    for(int i=1;i*i<=X;i++){
        if(X%i!=0){
            continue;
        }
        ans.emplace_back(i);
        if(i!=X/i){
            ans.emplace_back(X/i);
        }
    }
    return ans;
}

// 素因数分解
vl primefactor(ll N){
    vl ans;
    for(ll i=2;i*i<=N;i++){
        while(N%i==0){
            N/=i;
            ans.emplace_back(i);
        }
    }
    if(2<=N)ans.emplace_back(N);
    return ans;
}

// エラトステネスの篩
vb Eratosthenes(ll n){
    vb prime(n+1,true);
    prime[0]=prime[1]=false;

    for(ll i=2;i+i<=n;i++){
        if(!prime[i])continue;
        for(ll j=i*2;j<=n;j+=i){
            prime[j]=false;
        }
    }
    return prime;
}

// 一次元座標圧縮
vi compress(vi &A){
    vi B=A;
    ALL(sort,B);

    B.erase(unique(B.begin(),B.end()),B.end());
    vi ans(A.size());
    for(int i=0;i<A.size();i++){
        ans[i]=lower_bound(B.begin(),B.end(),A[i])-B.begin();
    }
    return ans;
}

// 最大公約数
ll gcd(ll A, ll B){
    if(B==0)return A;
    return gcd(B,A%B);
}

// 最小公倍数
ll lcm(ll A, ll B){
    return A / gcd(A, B) * B;
}

int main(){
    string S; cin>>S;
    if(S.size()<3){
        cout<<"NA"<<endl;
        return 0;
    }

    rep(i,S.size()-2){
        if(S[i]=='O' && S[i+1]=='O' && S[i+2]=='O'){
            cout<<"East"<<endl;
            return 0;
        }
        if(S[i]=='X' && S[i+1]=='X' && S[i+2]=='X'){
            cout<<"West"<<endl;
            return 0;
        }
    }
    cout<<"NA"<<endl;
}
0