結果

問題 No.253 ロウソクの長さ
ユーザー ishizuishizu
提出日時 2015-07-31 22:17:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 69,100 KB
実行使用メモリ 24,492 KB
平均クエリ数 30.86
最終ジャッジ日時 2023-09-23 21:02:36
合計ジャッジ時間 3,392 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,652 KB
testcase_01 AC 26 ms
24,360 KB
testcase_02 AC 24 ms
24,096 KB
testcase_03 AC 25 ms
23,448 KB
testcase_04 AC 26 ms
23,712 KB
testcase_05 AC 26 ms
24,492 KB
testcase_06 AC 26 ms
24,372 KB
testcase_07 AC 28 ms
24,312 KB
testcase_08 AC 25 ms
24,360 KB
testcase_09 AC 25 ms
23,472 KB
testcase_10 AC 26 ms
23,688 KB
testcase_11 AC 25 ms
24,360 KB
testcase_12 AC 24 ms
23,412 KB
testcase_13 AC 25 ms
24,024 KB
testcase_14 AC 25 ms
23,436 KB
testcase_15 AC 24 ms
24,108 KB
testcase_16 AC 25 ms
23,868 KB
testcase_17 AC 24 ms
23,436 KB
testcase_18 AC 25 ms
23,772 KB
testcase_19 AC 24 ms
24,048 KB
testcase_20 AC 25 ms
24,108 KB
testcase_21 AC 26 ms
23,652 KB
testcase_22 AC 25 ms
23,412 KB
testcase_23 AC 26 ms
23,448 KB
testcase_24 AC 29 ms
24,348 KB
testcase_25 AC 25 ms
23,664 KB
testcase_26 AC 24 ms
23,448 KB
testcase_27 AC 25 ms
23,412 KB
testcase_28 AC 24 ms
24,084 KB
testcase_29 AC 24 ms
24,072 KB
testcase_30 AC 25 ms
24,300 KB
testcase_31 AC 26 ms
24,276 KB
testcase_32 AC 26 ms
23,652 KB
testcase_33 AC 27 ms
24,384 KB
testcase_34 AC 25 ms
23,556 KB
testcase_35 AC 26 ms
23,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>

#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long

int ask(int Y){
	cout << "? " << Y << endl;
	int res;
	cin >> res;
	return res;
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int x=ask(80);
	if(x==0){cout<<"! 80"<<endl;}
	if(x<0){
		FOR(i,2,101){
			int a = ask(0);
			if(a==0) {cout<<"! "<<i-1<<endl;return 0;}
		}
	}
	int cnt=1;
	int l=80, r = 1e9+9;
	while(r>l){
		int med=(l+r)/2;
		int ans = ask(med-cnt);
		cnt++;
		if(ans==0) { cout<<"! "<<med<<endl;return  0;}
		if(ans<0) r=med+1;
		if(ans>0) l=med;
	}
	cout<< "! "<<l<<endl;

}
0