結果
問題 | No.253 ロウソクの長さ |
ユーザー | paruki |
提出日時 | 2016-07-27 11:46:45 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 1,100 bytes |
コンパイル時間 | 1,252 ms |
コンパイル使用メモリ | 165,020 KB |
実行使用メモリ | 24,372 KB |
平均クエリ数 | 35.00 |
最終ジャッジ日時 | 2023-09-24 00:23:24 |
合計ジャッジ時間 | 3,929 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
24,048 KB |
testcase_01 | AC | 23 ms
23,580 KB |
testcase_02 | AC | 24 ms
23,340 KB |
testcase_03 | AC | 19 ms
24,372 KB |
testcase_04 | AC | 20 ms
24,264 KB |
testcase_05 | AC | 22 ms
23,472 KB |
testcase_06 | AC | 20 ms
23,304 KB |
testcase_07 | AC | 21 ms
23,460 KB |
testcase_08 | AC | 20 ms
24,000 KB |
testcase_09 | AC | 20 ms
23,604 KB |
testcase_10 | AC | 23 ms
24,084 KB |
testcase_11 | AC | 22 ms
24,012 KB |
testcase_12 | AC | 23 ms
24,120 KB |
testcase_13 | AC | 20 ms
23,580 KB |
testcase_14 | AC | 20 ms
23,616 KB |
testcase_15 | AC | 24 ms
23,988 KB |
testcase_16 | AC | 22 ms
23,292 KB |
testcase_17 | AC | 20 ms
23,436 KB |
testcase_18 | AC | 20 ms
23,328 KB |
testcase_19 | AC | 20 ms
23,892 KB |
testcase_20 | AC | 20 ms
23,592 KB |
testcase_21 | AC | 21 ms
24,228 KB |
testcase_22 | AC | 21 ms
23,892 KB |
testcase_23 | AC | 20 ms
24,228 KB |
testcase_24 | AC | 21 ms
24,300 KB |
testcase_25 | AC | 20 ms
23,436 KB |
testcase_26 | AC | 20 ms
24,072 KB |
testcase_27 | AC | 20 ms
23,316 KB |
testcase_28 | AC | 21 ms
24,060 KB |
testcase_29 | AC | 19 ms
23,664 KB |
testcase_30 | AC | 20 ms
24,324 KB |
testcase_31 | AC | 19 ms
24,228 KB |
testcase_32 | AC | 21 ms
24,060 KB |
testcase_33 | AC | 21 ms
24,228 KB |
testcase_34 | AC | 22 ms
23,340 KB |
testcase_35 | AC | 21 ms
23,616 KB |
ソースコード
#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; } const int T = 95; int main(){ int b = ask(T); if(b <= 0){ for(int i = 0; i < T; ++i){ if(ask(0) == 0){ cout << "! " << i + 1 << endl; break; } } return 0; } int L = 0, R = 1000000001, cnt = 1; 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; }