結果

問題 No.2521 Don't be Same
ユーザー kotatsugamekotatsugame
提出日時 2023-10-27 22:17:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,217 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 74,268 KB
実行使用メモリ 98,844 KB
平均クエリ数 2.61
最終ジャッジ日時 2023-10-27 22:17:45
合計ジャッジ時間 5,499 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
24,564 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 59 ms
24,576 KB
testcase_04 AC 62 ms
24,576 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 59 ms
24,576 KB
testcase_11 AC 57 ms
24,576 KB
testcase_12 AC 56 ms
24,576 KB
testcase_13 AC 56 ms
24,576 KB
testcase_14 AC 65 ms
24,576 KB
testcase_15 AC 58 ms
24,576 KB
testcase_16 AC 60 ms
24,576 KB
testcase_17 AC 61 ms
24,576 KB
testcase_18 AC 58 ms
24,576 KB
testcase_19 AC 57 ms
24,576 KB
testcase_20 RE -
testcase_21 AC 58 ms
24,576 KB
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(X>=1&&X+1==Y||Y>=1&&Y+1==X)
	{
		cout<<"Second"<<endl;
		char c;int i,x;cin>>c>>i>>x;
		assert(c=='A');
		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<Y)
			{
				assert(X+1<Y);
				cout<<"A 2 "<<Y-X-1<<endl;
				Y=X+1;
			}
			else
			{
				assert(Y+1<X);
				cout<<"A 1 "<<X-Y-1<<endl;
				X=Y+1;
			}
		}
		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