結果

問題 No.246 質問と回答
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2020-02-08 10:51:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 1,850 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 196,044 KB
実行使用メモリ 24,240 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:33:31
合計ジャッジ時間 4,480 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
23,496 KB
testcase_01 AC 37 ms
23,916 KB
testcase_02 AC 36 ms
24,240 KB
testcase_03 AC 36 ms
23,496 KB
testcase_04 AC 39 ms
23,484 KB
testcase_05 AC 37 ms
23,988 KB
testcase_06 AC 36 ms
23,484 KB
testcase_07 AC 36 ms
23,664 KB
testcase_08 AC 37 ms
23,352 KB
testcase_09 AC 36 ms
23,760 KB
testcase_10 AC 36 ms
23,580 KB
testcase_11 AC 37 ms
23,556 KB
testcase_12 AC 37 ms
23,616 KB
testcase_13 AC 37 ms
23,316 KB
testcase_14 AC 38 ms
23,976 KB
testcase_15 AC 37 ms
23,556 KB
testcase_16 AC 38 ms
23,604 KB
testcase_17 AC 38 ms
24,156 KB
testcase_18 AC 38 ms
23,352 KB
testcase_19 AC 37 ms
23,964 KB
testcase_20 AC 37 ms
23,556 KB
testcase_21 AC 38 ms
23,916 KB
testcase_22 AC 36 ms
23,760 KB
testcase_23 AC 37 ms
23,916 KB
testcase_24 AC 37 ms
23,760 KB
testcase_25 AC 37 ms
23,484 KB
testcase_26 AC 37 ms
24,228 KB
testcase_27 AC 38 ms
23,304 KB
testcase_28 AC 37 ms
23,940 KB
testcase_29 AC 39 ms
23,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/







bool debug = true;
int x = 10;




//---------------------------------------------------------------------------------------------------
bool ask(int y) {
	printf("? %d\n", y);
	fflush(stdout);

	int res; cin >> res;
	return res == 1;
}
void answer(int y) {
	printf("! %d\n", y);
	fflush(stdout);
}
//---------------------------------------------------------------------------------------------------
void _main() {
	int ok = 1, ng = 1e9+1;
	while (ok + 1 != ng) {
		int md = (ok + ng) / 2;
		if (ask(md)) ok = md;
		else ng = md;
	}
	answer(ok);
}





0