結果

問題 No.2521 Don't be Same
ユーザー kotatsugame
提出日時 2023-10-27 22:17:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,217 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 74,716 KB
実行使用メモリ 25,604 KB
平均クエリ数 2.68
最終ジャッジ日時 2024-09-25 14:20:27
合計ジャッジ時間 6,252 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12 RE * 15
権限があれば一括ダウンロードができます

ソースコード

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