結果

問題 No.726 Tree Game
ユーザー gazellegazelle
提出日時 2018-08-24 22:02:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,478 bytes
コンパイル時間 2,325 ms
コンパイル使用メモリ 197,944 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 11:47:37
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll y,x;
	cin>>y>>x;
	ll _x=x,_y=y;
	while(1) {
		bool d=false;
		for(ll i=2; i*i<=_x;i++) {
			if(_x%i==0) {
				d=true;
				break;
			}
		}
		if(!d&&_x!=1) break;
		_x++;
	}
	while(1) {
		bool d=false;
		for(ll i=2; i*i<=_y;i++) {
			if(_y%i==0) {
				d=true;
				break;
			}
		}
		if(!d&&_y!=1) break;
		_y++;
	}

	if(_x==x&&_y==y) {
		cout<<"Second"<<endl;
	} else if(_x==x) {
		_x++;
		while(1) {
			bool d=false;
			for(ll i=2; i*i<=_x;i++) {
				if(_x%i==0) {
					d=true;
					break;
				}
			}
			if(!d) break;
			_x++;
		}
		if((abs((x+1)-_x)+abs(y-_y))%2) cout<<"Second"<<endl;
		else cout<<"First"<<endl;
	} else if(_y==y) {
		_y++;
		while(1) {
			bool d=false;
			for(ll i=2; i*i<=_y;i++) {
				if(_y%i==0) {
					d=true;
					break;
				}
			}
			if(!d) break;
			_y++;
		}
		if((abs(x-_x)+abs((y+1)-_y))%2) cout<<"Second"<<endl;
		else cout<<"First"<<endl;
	} else {
		if((abs(x-_x)+abs(y-_y))%2) cout<<"First"<<endl;
		else cout<<"Second"<<endl;
	}
}
0