結果
問題 | No.253 ロウソクの長さ |
ユーザー | imulan |
提出日時 | 2016-10-09 23:21:13 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,221 bytes |
コンパイル時間 | 1,365 ms |
コンパイル使用メモリ | 165,148 KB |
実行使用メモリ | 24,264 KB |
平均クエリ数 | 9.14 |
最終ジャッジ日時 | 2023-09-24 00:36:08 |
合計ジャッジ時間 | 5,712 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
23,376 KB |
testcase_01 | AC | 26 ms
23,592 KB |
testcase_02 | AC | 26 ms
23,376 KB |
testcase_03 | AC | 25 ms
24,264 KB |
testcase_04 | AC | 25 ms
23,616 KB |
testcase_05 | AC | 25 ms
23,496 KB |
testcase_06 | AC | 25 ms
23,964 KB |
testcase_07 | AC | 25 ms
24,144 KB |
testcase_08 | AC | 26 ms
23,772 KB |
testcase_09 | AC | 23 ms
23,976 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second int ct=0; int ask(int Y) { ++ct; cout << "? " << Y << endl; int res; cin >>res; return res; } int main() { int ans=-1; int res=ask(10); if(res==0) { printf("! 10\n"); return 0; } res=ask(90); if(res==0) ans=90; else if(res==-1) { while(res!=0) res=ask(9); ans=9+ct-1; } else { int l=90, r=1000000000; while(r-l>1) { // printf("l= %d, r= %d\n", l,r); int m=(l+r)/2; res=ask(m); if(res==0) { ans=m+ct-1; break; } else if(res==-1) { --l; r=m; } else { --r; l=m; } } if(ans==-1) ans=l+ct-1; } cout << "! " << ans << endl; return 0; }