結果
| 問題 | No.253 ロウソクの長さ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-11 01:23:47 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 1,850 ms |
| コンパイル使用メモリ | 207,960 KB |
| 実行使用メモリ | 54,088 KB |
| 最終ジャッジ日時 | 2026-06-10 15:21:03 |
| 合計ジャッジ時間 | 8,002 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 35 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int ask(int x){
printf("? %d\n",x);
fflush(stdout);
int res; scanf("%d",&res);
return res;
}
void answer(int x){
printf("! %d\n",x);
fflush(stdout);
}
int main(){
int res=ask(100);
if(res==0){
answer(100);
}
else if(res==-1){
int t;
for(t=1;ask(t)!=0;t++);
answer(t);
}
else{
int t=1;
int lo=100,hi=1e9;
while(hi-lo>0){
int mi=(lo+hi)/2;
if(ask(mi-t)!=-1) lo=mi;
else hi=mi;
t++;
}
answer(lo);
}
return 0;
}