結果

問題 No.253 ロウソクの長さ
ユーザー parukiparuki
提出日時 2016-07-27 11:26:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 918 bytes
コンパイル時間 1,573 ms
コンパイル使用メモリ 163,852 KB
実行使用メモリ 24,516 KB
平均クエリ数 29.75
最終ジャッジ日時 2023-09-23 11:13:10
合計ジャッジ時間 5,312 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,844 KB
testcase_01 AC 25 ms
24,048 KB
testcase_02 AC 26 ms
23,532 KB
testcase_03 AC 26 ms
23,832 KB
testcase_04 WA -
testcase_05 AC 25 ms
23,424 KB
testcase_06 AC 24 ms
23,832 KB
testcase_07 AC 24 ms
23,628 KB
testcase_08 AC 25 ms
24,408 KB
testcase_09 WA -
testcase_10 AC 25 ms
24,048 KB
testcase_11 AC 25 ms
23,424 KB
testcase_12 AC 25 ms
23,376 KB
testcase_13 AC 25 ms
24,204 KB
testcase_14 WA -
testcase_15 AC 24 ms
23,424 KB
testcase_16 AC 26 ms
24,324 KB
testcase_17 AC 25 ms
24,348 KB
testcase_18 AC 25 ms
24,324 KB
testcase_19 WA -
testcase_20 AC 25 ms
23,364 KB
testcase_21 AC 25 ms
23,616 KB
testcase_22 WA -
testcase_23 AC 25 ms
23,724 KB
testcase_24 AC 24 ms
23,376 KB
testcase_25 AC 25 ms
23,412 KB
testcase_26 AC 25 ms
23,832 KB
testcase_27 AC 25 ms
24,372 KB
testcase_28 AC 24 ms
24,048 KB
testcase_29 AC 24 ms
23,640 KB
testcase_30 AC 24 ms
23,376 KB
testcase_31 AC 24 ms
23,664 KB
testcase_32 AC 25 ms
23,424 KB
testcase_33 AC 24 ms
23,832 KB
testcase_34 WA -
testcase_35 AC 25 ms
23,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

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

int main(){
    int L = 0, R = 1000000001, cnt = 0;
    while(R - L > 1){
        int M = (L + R) / 2;
        int a = ask(M);
        if(a == 0)L = M, R = M + 1;
        else (a > 0 ? L : R) = M;
        L = max(0, L - 1);
        R = max(1, R - 1);
        ++cnt;
    }
    cout << "! " << L+cnt << endl;
    return 0;
}
0