結果

問題 No.2357 Guess the Function
ユーザー shobonvipshobonvip
提出日時 2023-06-23 21:36:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 562 bytes
コンパイル時間 5,113 ms
コンパイル使用メモリ 259,252 KB
実行使用メモリ 24,300 KB
平均クエリ数 2.91
最終ジャッジ日時 2023-09-13 16:35:43
合計ジャッジ時間 6,231 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,520 KB
testcase_01 AC 23 ms
24,300 KB
testcase_02 AC 24 ms
23,364 KB
testcase_03 AC 24 ms
23,604 KB
testcase_04 AC 23 ms
24,264 KB
testcase_05 AC 24 ms
24,276 KB
testcase_06 AC 23 ms
24,168 KB
testcase_07 AC 23 ms
23,400 KB
testcase_08 AC 23 ms
23,952 KB
testcase_09 AC 22 ms
23,628 KB
testcase_10 AC 23 ms
23,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

int main(){
	cout << "? 100" << endl;
	int r1; cin >> r1;
	// (100 + a) % b = r1;
	if (r1 == 99){
		cout << "! 99 100" << endl;
		return 0;
	}
	// b を暴く 99 - r1
	cout << "? " << 99 - r1 << endl;
	int r2; cin >> r2;
	int b = r2 + 1;
	int md = -1;
	for (int a=0; a<b; a++){
		if ((a + 100) % b == r1 && (a + 99 - r1) % b == r2){
			assert(md == -1);
			md = a;
		}
	}
	cout << "! " << md << " " << b << endl;
}
 
0