結果

問題 No.486 3 Straight Win(3連勝)
ユーザー karin7831
提出日時 2017-02-27 11:15:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 864 bytes
コンパイル時間 2,802 ms
コンパイル使用メモリ 179,080 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 04:10:55
合計ジャッジ時間 2,423 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;

vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<ll, ll> mp;

int main()
{
	string s;
	cin >> s;
	bool isw = false;
	int cnt = 0;
	REP(i,s.size())
	{
		if(cnt>=3)
		{
			cout << (isw ? "West" : "East") << endl;
			return 0;
		}
		if(s[i]=='O')
		{
			if (isw) {
				cnt = 1;
				isw = false;
			}
			else cnt++;
		}
		else
		{
			if (isw) cnt++;
			else {
				cnt = 1;
				isw = true;
			}
		}
	}
	if (cnt >= 3)
	{
		cout << (isw ? "West" : "East") << endl;
		return 0;
	}
	else cout << "NA" << endl;
}
0