結果

問題 No.253 ロウソクの長さ
ユーザー tanimani364tanimani364
提出日時 2019-12-05 17:02:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,517 bytes
コンパイル時間 1,265 ms
コンパイル使用メモリ 131,100 KB
実行使用メモリ 24,420 KB
平均クエリ数 54.42
最終ジャッジ日時 2023-09-23 19:14:58
合計ジャッジ時間 4,726 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
24,060 KB
testcase_01 AC 27 ms
23,520 KB
testcase_02 AC 27 ms
23,376 KB
testcase_03 AC 26 ms
23,664 KB
testcase_04 AC 26 ms
23,976 KB
testcase_05 AC 27 ms
24,180 KB
testcase_06 AC 28 ms
23,880 KB
testcase_07 AC 28 ms
23,352 KB
testcase_08 AC 28 ms
24,072 KB
testcase_09 AC 26 ms
23,652 KB
testcase_10 AC 28 ms
24,240 KB
testcase_11 AC 29 ms
23,352 KB
testcase_12 AC 28 ms
24,420 KB
testcase_13 AC 28 ms
23,676 KB
testcase_14 AC 26 ms
24,252 KB
testcase_15 AC 30 ms
23,508 KB
testcase_16 WA -
testcase_17 AC 27 ms
23,436 KB
testcase_18 AC 28 ms
23,376 KB
testcase_19 WA -
testcase_20 AC 28 ms
23,424 KB
testcase_21 AC 27 ms
23,532 KB
testcase_22 AC 26 ms
24,300 KB
testcase_23 AC 28 ms
24,096 KB
testcase_24 AC 27 ms
23,628 KB
testcase_25 AC 29 ms
23,340 KB
testcase_26 AC 28 ms
23,688 KB
testcase_27 AC 28 ms
24,024 KB
testcase_28 AC 28 ms
23,508 KB
testcase_29 AC 27 ms
23,856 KB
testcase_30 AC 29 ms
23,268 KB
testcase_31 AC 28 ms
23,652 KB
testcase_32 AC 28 ms
23,976 KB
testcase_33 AC 29 ms
23,580 KB
testcase_34 AC 26 ms
24,072 KB
testcase_35 AC 29 ms
24,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

int C(int mid){
    cout<<"? "<<mid<<endl;
    int res;
    cin>>res;
    return res;
}
void solve(){
    int l=10,r=101,mid;
    int cnt=0;
    int x;
    rep(i,50){
        mid=i+10;
        x=C(mid);
        if(x==-1){
            cout<<mid+cnt-1<<"\n";
            return;
        }
        else if(x==0){
            cout<<"! "<<mid+cnt<<"\n";
            return;
        }
        ++cnt;
    }
    l=10,r=1e9+1;
    rep(i,50){
        int mid=(l+r)/2;
        x=C(mid-cnt);
        if(x==-1)r=mid;
        else if(x==1)l=mid;
        else {
            cout<<"! "<<mid<<endl;
            return ;
        }
        ++cnt;
    }
}
 
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}
0