結果

問題 No.513 宝探し2
ユーザー nanophoto12nanophoto12
提出日時 2017-08-17 20:32:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,041 bytes
コンパイル時間 1,175 ms
コンパイル使用メモリ 89,004 KB
実行使用メモリ 24,252 KB
平均クエリ数 19.50
最終ジャッジ日時 2023-09-24 01:30:54
合計ジャッジ時間 1,834 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,976 KB
testcase_01 AC 24 ms
23,916 KB
testcase_02 AC 25 ms
24,036 KB
testcase_03 AC 25 ms
23,976 KB
testcase_04 AC 25 ms
24,240 KB
testcase_05 AC 24 ms
24,132 KB
testcase_06 AC 25 ms
23,364 KB
testcase_07 AC 25 ms
24,120 KB
testcase_08 AC 24 ms
24,036 KB
testcase_09 AC 24 ms
24,024 KB
testcase_10 AC 25 ms
24,120 KB
testcase_11 AC 25 ms
24,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> t3;

int process(int x, int y)
{
    cout << x << " " << y << endl;
    int d;
    cin>>d;
    return d;
}

int mid(int l, int r)
{
    return (l + r)/2;
}

int main(){
    int lx = 0;
    int rx = 100000;
    int ld = process(lx, 0);
    int rd = process(rx, 0);
    
    while(rx - lx > 1)
    {
        if(ld < rd)
        {
            rx = mid(lx, rx);
            rd = process(rx, 0);
        }
        else
        {
            lx = mid(lx, rx);
            ld = process(lx, 0);
        }
    }
    if(ld < rd)
    {
        process(lx, ld);
    }
    else
    {
        process(rx, rd);
    }
    return 0;
}
0