結果
| 問題 | No.253 ロウソクの長さ | 
| コンテスト | |
| ユーザー |  goodbaton | 
| 提出日時 | 2015-07-24 22:42:28 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                TLE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,033 bytes | 
| コンパイル時間 | 614 ms | 
| コンパイル使用メモリ | 72,312 KB | 
| 実行使用メモリ | 39,888 KB | 
| 平均クエリ数 | 2.67 | 
| 最終ジャッジ日時 | 2024-07-16 20:48:22 | 
| 合計ジャッジ時間 | 4,290 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 TLE * 1 -- * 32 | 
ソースコード
#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-1;
        }else{
            ans(mid);
            return 0;
        }
        
    }
    
    return 0;
}
            
            
            
        