結果
| 問題 |
No.253 ロウソクの長さ
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-24 22:44:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,031 bytes |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 81,064 KB |
| 実行使用メモリ | 41,908 KB |
| 平均クエリ数 | 24.36 |
| 最終ジャッジ日時 | 2025-02-07 08:46:01 |
| 合計ジャッジ時間 | 27,472 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 TLE * 8 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000003
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define SIZE 100
int ask(int Y){
cout << "? " << Y << endl;
int res;
cin >> res;
return res;
}
void ans(int Y){
cout << "! " << Y << endl;
return;
}
int main(){
int res;
int l=10,r=1000000000,mid;
if(ask(31)==-1){
for(int i=0;;i++){
if(ask(0)==0){
ans(i);
}
}
}
for(int i=1;i<=30;i++){
mid = (l+r)/2;
int q = ask(mid-i);
if(q==1){
l = mid+1;
}else if(q==-1){
r = mid;
}else{
ans(mid);
return 0;
}
}
return 0;
}
goodbaton