結果

問題 No.253 ロウソクの長さ
ユーザー kyuridenamidakyuridenamida
提出日時 2015-07-24 23:49:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 144,276 KB
実行使用メモリ 24,408 KB
平均クエリ数 28.28
最終ジャッジ日時 2023-09-23 21:00:11
合計ジャッジ時間 4,143 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,036 KB
testcase_01 AC 25 ms
23,472 KB
testcase_02 AC 26 ms
24,024 KB
testcase_03 AC 25 ms
23,436 KB
testcase_04 AC 24 ms
23,700 KB
testcase_05 AC 25 ms
23,460 KB
testcase_06 AC 25 ms
23,460 KB
testcase_07 AC 25 ms
24,096 KB
testcase_08 AC 25 ms
23,676 KB
testcase_09 AC 24 ms
23,868 KB
testcase_10 AC 25 ms
23,736 KB
testcase_11 AC 26 ms
24,036 KB
testcase_12 AC 26 ms
24,036 KB
testcase_13 AC 26 ms
24,060 KB
testcase_14 AC 25 ms
24,300 KB
testcase_15 AC 24 ms
23,724 KB
testcase_16 AC 25 ms
23,436 KB
testcase_17 AC 26 ms
23,856 KB
testcase_18 AC 26 ms
23,868 KB
testcase_19 AC 24 ms
23,472 KB
testcase_20 AC 26 ms
23,460 KB
testcase_21 AC 26 ms
24,240 KB
testcase_22 AC 26 ms
23,700 KB
testcase_23 AC 26 ms
23,424 KB
testcase_24 AC 25 ms
24,204 KB
testcase_25 AC 27 ms
24,312 KB
testcase_26 AC 26 ms
23,640 KB
testcase_27 AC 26 ms
23,580 KB
testcase_28 AC 26 ms
23,700 KB
testcase_29 AC 26 ms
24,408 KB
testcase_30 AC 26 ms
24,300 KB
testcase_31 AC 26 ms
23,580 KB
testcase_32 AC 26 ms
23,592 KB
testcase_33 AC 27 ms
23,664 KB
testcase_34 AC 25 ms
23,448 KB
testcase_35 AC 25 ms
23,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int Q(int n){
	cout << "? " << n << endl;
	string s1;
	int ans;
	cin >> ans;
	return ans;
}

int D(int a){
	cout << "! " << a << endl;
	exit(0);
}

int main(){
	int T = 0;
	T++;
	if( Q(100) == -1 ){
		for(int i = 0 ; i < 100 ; i++ ){
			int t = Q(i);
			if( t == -1 ){
				D(i+T-1);
			}else if( t == 0 ) D(i+T);
			T++;
		}
	}else{
		int l = 0 , r = 1e9;
		while( l != r ){
			int m = (l+r+1) / 2;
			if( Q(m-T) == -1 ){ // Y < (?)
				r = m-1;
			}else{
				l = m;
			}
			T++;
		}
		D(l);
		
	}
	
	
}
0