結果

問題 No.513 宝探し2
ユーザー latte0119latte0119
提出日時 2017-05-05 22:29:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,155 bytes
コンパイル時間 1,098 ms
コンパイル使用メモリ 144,328 KB
実行使用メモリ 24,312 KB
平均クエリ数 53.42
最終ジャッジ日時 2023-09-24 01:01:44
合計ジャッジ時間 2,334 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,628 KB
testcase_01 AC 25 ms
24,252 KB
testcase_02 AC 25 ms
24,024 KB
testcase_03 AC 25 ms
23,640 KB
testcase_04 AC 26 ms
24,240 KB
testcase_05 AC 25 ms
23,304 KB
testcase_06 AC 24 ms
23,376 KB
testcase_07 AC 24 ms
23,316 KB
testcase_08 AC 24 ms
24,312 KB
testcase_09 AC 25 ms
23,964 KB
testcase_10 AC 25 ms
23,964 KB
testcase_11 AC 24 ms
23,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int x,y;
    int lb=-1,ub=100000;
    while(ub-lb>1){
        int mid=(ub+lb)/2;
        int a,b;

        cout<<0<<" "<<mid<<endl;
        cin>>a;
        if(a==0)return 0;
        cout<<0<<" "<<mid+1<<endl;
        cin>>b;
        if(b==0)return 0;
        if(a>b)lb=mid;
        else ub=mid;
    }

    y=ub;
    lb=-1;ub=100000;

    while(ub-lb>1){
        int mid=(ub+lb)/2;
        int a,b;

        cout<<mid<<" "<<y<<endl;
        cin>>a;
        if(a==0)return 0;
        cout<<mid+1<<" "<<y<<endl;
        cin>>b;
        if(b==0)return 0;
        if(a>b)lb=mid;
        else ub=mid;
    }

    x=ub;

    cout<<x<<" "<<y<<endl;
    int latte;
    cin>>latte;
    assert(latte==0);
    return 0;
}
0