結果

問題 No.246 質問と回答
ユーザー azbrugbyazbrugby
提出日時 2019-03-12 22:15:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,189 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 74,208 KB
実行使用メモリ 24,312 KB
平均クエリ数 30.87
最終ジャッジ日時 2023-09-23 20:30:32
合計ジャッジ時間 3,668 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
23,772 KB
testcase_01 AC 40 ms
24,156 KB
testcase_02 AC 40 ms
23,280 KB
testcase_03 AC 42 ms
23,556 KB
testcase_04 AC 40 ms
24,288 KB
testcase_05 AC 41 ms
23,556 KB
testcase_06 AC 41 ms
23,376 KB
testcase_07 AC 40 ms
24,108 KB
testcase_08 AC 41 ms
24,168 KB
testcase_09 AC 40 ms
23,580 KB
testcase_10 AC 40 ms
24,288 KB
testcase_11 AC 41 ms
23,172 KB
testcase_12 AC 41 ms
23,964 KB
testcase_13 AC 40 ms
23,364 KB
testcase_14 AC 40 ms
23,568 KB
testcase_15 AC 40 ms
23,340 KB
testcase_16 AC 40 ms
23,616 KB
testcase_17 AC 41 ms
23,448 KB
testcase_18 AC 40 ms
24,084 KB
testcase_19 AC 40 ms
23,484 KB
testcase_20 AC 40 ms
23,484 KB
testcase_21 AC 40 ms
24,312 KB
testcase_22 AC 41 ms
24,108 KB
testcase_23 AC 40 ms
23,436 KB
testcase_24 AC 40 ms
23,376 KB
testcase_25 AC 40 ms
23,376 KB
testcase_26 AC 40 ms
23,592 KB
testcase_27 AC 41 ms
23,964 KB
testcase_28 AC 40 ms
23,436 KB
testcase_29 AC 40 ms
24,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <cstdio>
#include <cmath>
#include <bitset>
#define mk make_pair
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pos;

const ll MOD = 1234567, N = 100010, dx[4] = { -1,1,0,0 }, dy[4] = { 0,0,-1,1 }, MIN = -72340172838, MAX = 72340172838;

ll mn(ll a, ll b) {
	if (a == -1)return b;
	if (b == -1)return a;
	return min(a, b);
}
ll gcd(ll v1, ll v2) {
	if (v1 == 0)return v2; if (v2 == 0)return v1; if (v2 > v1)return gcd(v2%v1, v1); return gcd(v1%v2, v2);
}

ll pw(ll v1, ll v2) {
	ll v3 = 1;
	while (v2 > 0) {
		if (v2 % 2)v3 = (v3*v1) % MOD;
		v1 = (v1*v1) % MOD;
		v2 /= 2;
	}
	return v3;
}

struct ab {
	ll a, b;
	bool operator<(const ab& right) const {
		return right.b*a - right.a*b < 0;
	}
};

ll mnv = 0, mxv = 1000000001;

bool ok(ll md) {
	cout << "? " << md << endl;
	ll v1; cin >> v1;
	cout.flush();
	return (v1==1);
}

int main() {
	while (mxv - mnv > 1) {
		ll md = (mxv + mnv) / 2;
		if (ok(md))mnv = md;
		else mxv = md;
	}
	cout <<"! "<< mnv << endl;
	return 0;
}
0