結果

問題 No.2521 Don't be Same
ユーザー kotatsugamekotatsugame
提出日時 2023-10-27 22:25:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 1,605 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 74,696 KB
実行使用メモリ 24,648 KB
平均クエリ数 9.43
最終ジャッジ日時 2023-10-27 22:25:28
合計ジャッジ時間 4,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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)
			{
				if(X%2==1)
				{
					cout<<"A 2 "<<Y-X-1<<endl;
					Y=X+1;
				}
				else
				{
					cout<<"A 2 "<<Y-X+1<<endl;
					Y=X-1;
				}
			}
			else if(Y+1<X)
			{
				if(Y%2==1)
				{
					cout<<"A 1 "<<X-Y-1<<endl;
					X=Y+1;
				}
				else
				{
					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