結果

問題 No.2357 Guess the Function
ユーザー kotatsugamekotatsugame
提出日時 2023-06-23 21:34:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,082 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 73,528 KB
実行使用メモリ 24,336 KB
平均クエリ数 1.00
最終ジャッジ日時 2023-09-13 16:34:14
合計ジャッジ時間 3,943 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
vector<pair<int,int> >AB[100];
int vis[100];
int X2[100];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int tm=0;
	for(int x1=1;x1<=100;x1++)
	{
		for(int i=0;i<100;i++)AB[i].clear();
		for(int A=0;A<100;A++)for(int B=A+1;B<=100;B++)
		{
			int t=(A+x1)%B;
			AB[t].push_back(make_pair(A,B));
		}
		bool out=false;
		for(int i=0;i<100;i++)
		{
			bool fn=false;
			for(int x2=1;x2<=100;x2++)
			{
				++tm;
				bool same=false;
				for(pair<int,int>p:AB[i])
				{
					int A=p.first,B=p.second;
					int t=(A+x2)%B;
					if(vis[t]==tm)
					{
						same=true;
						break;
					}
					vis[t]=tm;
				}
				if(!same)
				{
					fn=true;
					X2[i]=x2;
					break;
				}
			}
			if(!fn)
			{
				out=true;
				break;
			}
		}
		if(!out)
		{
			cout<<x1<<endl;
			int i;cin>>i;
			cout<<X2[i]<<endl;
			int y;cin>>y;
			for(pair<int,int>p:AB[i])
			{
				int A=p.first,B=p.second;
				if((A+X2[i])%B==y)
				{
					cout<<A<<" "<<B<<endl;
					return 0;
				}
			}
		}
	}
}
0