結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
![]() |
提出日時 | 2017-02-24 22:24:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,501 bytes |
コンパイル時間 | 867 ms |
コンパイル使用メモリ | 94,152 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 03:52:30 |
合計ジャッジ時間 | 1,774 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <iostream>#include <iomanip>#include <string>#include <vector>#include <queue>#include <algorithm>#include <utility>#include <cmath>#include <map>#include <set>#include <stack>#include <cstdio>#include <cstdlib>#include <cstring>#define INF_LL 1e18#define INF 1e9#define REP(i, n) for(int i = 0;i < (n);i++)#define FOR(i, a, b) for(int i = (a);i < (b);i++)#define all(x) x.begin(),x.end()using namespace std;using ll = long long;using PII = pair<int, int>;template<typename T>void chmax(T &a, T &b){a = max(a, b);}template<typename T>void chmin(T &a, T &b){a = min(a, b);}class Union_find{private:vector<int> par;vector<int> rank;int n;public:Union_find(int a){n = a;for(int i = 0;i < n;i++){par.push_back(i);rank.push_back(0);}}int find(int x){if(par[x] == x){return x;}else{return par[x] = find(par[x]);}}void unite(int x, int y){x = find(x);y = find(y);if(x == y) return;if(rank[x] < rank[y]){par[x] = y;}else{par[y] = x;if(rank[x] == rank[y]) rank[x]++;}}bool same(int x, int y){return find(x) == find(y);}};int main(void){cin.tie(0);ios::sync_with_stdio(false);string S;int e = 0, w = 0;cin >> S;REP(i, S.size()){if(S[i] == 'O'){e++;w = 0;}else{w++;e = 0;}if(e > 2){cout << "East" << endl;return 0;}else if(w > 2){cout << "West" << endl;return 0;}}cout << "NA" << endl;return 0;}