結果

問題 No.2521 Don't be Same
ユーザー kotatsugamekotatsugame
提出日時 2023-10-27 22:23:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,417 bytes
コンパイル時間 1,378 ms
コンパイル使用メモリ 74,560 KB
実行使用メモリ 24,624 KB
平均クエリ数 2.54
最終ジャッジ日時 2023-10-27 22:23:39
合計ジャッジ時間 6,252 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<set>
#include<cassert>
using namespace std;
int G[100][100];
void calcG()
{
	G[0][0]=0;
	for(int a=0;a<100;a++)for(int b=0;b<100;b++)
	{
		if(a==0&&b==0)continue;
		set<int>S;
		if(a==b)S.insert(G[0][0]);
		for(int i=1;i<=a;i++)S.insert(G[a-i][b]);
		for(int i=1;i<=b;i++)S.insert(G[a][b-i]);
		int g=0;
		while(S.find(g)!=S.end())g++;
		G[a][b]=g;
	}
	for(int a=0;a<10;a++)
	{
		for(int b=0;b<10;b++)cout<<G[a][b]<<"\t";
		cout<<endl;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int X,Y;
	cin>>X>>Y;
	if(abs(X-Y)==1&&min(X,Y)%2==1)
	{
		cout<<"Second"<<endl;
		char c;
		cin>>c;
		if(c=='C')return 0;
		assert(c=='A');
		int i,x;
		cin>>i>>x;
		if(i==1)X-=x;
		else Y-=x;
	}
	else cout<<"First"<<endl;
	while(true)
	{
		assert(!(X==0&&Y==0));
		if(X==Y)
		{
			cout<<"B"<<endl;
			X=Y=0;
		}
		else if(X==0)
		{
			cout<<"A 2 "<<Y<<endl;
			Y=0;
		}
		else if(Y==0)
		{
			cout<<"A 1 "<<X<<endl;
			X=0;
		}
		else
		{
			if(X+1<Y)
			{
				cout<<"A 2 "<<Y-X-1<<endl;
				Y=X+1;
			}
			else if(Y+1<X)
			{
				cout<<"A 1 "<<X-Y-1<<endl;
				X=Y+1;
			}
			else if(X+1==Y)
			{
				assert(X%2==0);
				cout<<"A 2 2"<<endl;
				Y-=2;
			}
			else if(Y+1==X)
			{
				assert(Y%2==0);
				cout<<"A 1 2"<<endl;
				X-=2;
			}
			else assert(false);
		}
		char c;int i,x;
		cin>>c;
		if(c=='C')return 0;
		assert(c=='A');
		cin>>i>>x;
		if(i==1)X-=x;
		else Y-=x;
	}
}
0