結果

問題 No.2521 Don't be Same
ユーザー 沙耶花沙耶花
提出日時 2023-10-27 22:45:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 1,519 bytes
コンパイル時間 4,240 ms
コンパイル使用メモリ 261,852 KB
実行使用メモリ 24,648 KB
平均クエリ数 10.57
最終ジャッジ日時 2023-10-27 22:45:59
合計ジャッジ時間 7,976 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
bool check(int a,int b){
	if(a==b)return 1;
	if(a==0||b==0)return 1;
	int ret = 0;
	for(int i=1;i<=a;i++){
		if(check(a-i,b)==0)ret = 1;
	}
	for(int i=1;i<=b;i++){
		if(check(a,b-i)==0)ret = 1;
	}
	return ret;
}

int main(){
	/*
	for(int i=1;i<=10;i++){
		for(int j=1;j<=10;j++){
			cout<<check(i,j);
		}
		cout<<endl;
	}
	*/
	int X,Y;
	cin>>X>>Y;
	bool f = true;
	if(abs(X-Y)==1 && min(X,Y)%2==1){
		cout<<"Second"<<endl;
		f = false;
	}
	else{
		cout<<"First"<<endl;
		f = true;
	}

	while(true){
		if(f){
			f = false;
			if(X==Y){
				cout<<"B"<<endl;
				return 0;
			}
			if(X==0){
				cout<<"A "<<2<<' '<<Y<<endl;
				return 0;
			}
			if(Y==0){
				cout<<"A "<<1<<' '<<X<<endl;
				return 0;
			}
			
			if(X%2==1 && (X+1)<Y){
				cout<<"A "<<2<<' '<<(Y-(X+1))<<endl;
				Y = X+1;
				continue;
			}
			if(X%2==0 && (X-1)<Y && (X-1)>0){
				cout<<"A "<<2<<' '<<(Y-(X-1))<<endl;
				Y = X-1;
				continue;
			}
			
			if(Y%2==1 && (Y+1)<X){
				cout<<"A "<<1<<' '<<(X-(Y+1))<<endl;
				X= Y+1;
				continue;
			}
			if(Y%2==0 && (Y-1)<X && (Y-1)>0){
				cout<<"A "<<1<<' '<<(X-(Y-1))<<endl;
				X = Y-1;
				continue;
			}
			
		}
		else{
			char c;
			cin>>c;
			int ii,xx;
			cin>>ii>>xx;
			if(ii==1)X -= xx;
			else Y -= xx;
			f = true;
		}
	}
	
	return 0;
}
0