結果

問題 No.253 ロウソクの長さ
ユーザー parukiparuki
提出日時 2016-07-27 11:37:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 997 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 163,848 KB
実行使用メモリ 24,420 KB
平均クエリ数 55.19
最終ジャッジ日時 2023-09-23 11:13:51
合計ジャッジ時間 4,863 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,400 KB
testcase_01 WA -
testcase_02 AC 27 ms
23,832 KB
testcase_03 AC 26 ms
23,844 KB
testcase_04 AC 27 ms
24,372 KB
testcase_05 WA -
testcase_06 AC 27 ms
24,312 KB
testcase_07 AC 26 ms
23,424 KB
testcase_08 AC 27 ms
23,412 KB
testcase_09 AC 25 ms
23,676 KB
testcase_10 AC 28 ms
23,664 KB
testcase_11 AC 28 ms
23,376 KB
testcase_12 AC 27 ms
23,532 KB
testcase_13 AC 26 ms
23,520 KB
testcase_14 AC 25 ms
23,556 KB
testcase_15 AC 27 ms
23,544 KB
testcase_16 AC 27 ms
23,436 KB
testcase_17 AC 29 ms
24,372 KB
testcase_18 AC 27 ms
23,532 KB
testcase_19 AC 25 ms
24,300 KB
testcase_20 AC 27 ms
23,664 KB
testcase_21 WA -
testcase_22 AC 28 ms
23,412 KB
testcase_23 AC 27 ms
23,400 KB
testcase_24 AC 27 ms
23,376 KB
testcase_25 AC 27 ms
23,640 KB
testcase_26 AC 27 ms
23,424 KB
testcase_27 AC 27 ms
23,664 KB
testcase_28 AC 27 ms
24,024 KB
testcase_29 AC 28 ms
24,420 KB
testcase_30 AC 27 ms
23,556 KB
testcase_31 AC 27 ms
23,436 KB
testcase_32 AC 27 ms
23,664 KB
testcase_33 AC 27 ms
23,652 KB
testcase_34 AC 26 ms
23,676 KB
testcase_35 AC 27 ms
24,216 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(){
    for(int i = 0; i < 35; ++i){
        if(ask(0) == 0){
            cout << "! " << i << endl;
            return 0;
        }
    }
    int L = 0, R = 1000000001, cnt = 35;
    while(R - L > 1){
        int M = (L + R) / 2;
        int a = ask(max(M - cnt++, 0));
        if(a == 0)L = M, R = M + 1;
        else (a > 0 ? L : R) = M;
    }
    cout << "! " << L << endl;
    return 0;
}
0