結果

問題 No.594 壊れた宝物発見機
ユーザー parukiparuki
提出日時 2017-11-21 15:23:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 1,361 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 164,608 KB
実行使用メモリ 24,384 KB
平均クエリ数 51.40
最終ジャッジ日時 2023-09-23 15:08:19
合計ジャッジ時間 4,777 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
23,988 KB
testcase_01 AC 100 ms
23,388 KB
testcase_02 AC 98 ms
24,072 KB
testcase_03 AC 103 ms
23,820 KB
testcase_04 AC 105 ms
23,580 KB
testcase_05 AC 102 ms
24,348 KB
testcase_06 AC 101 ms
23,580 KB
testcase_07 AC 104 ms
24,060 KB
testcase_08 AC 101 ms
23,664 KB
testcase_09 AC 105 ms
24,048 KB
testcase_10 AC 99 ms
24,072 KB
testcase_11 AC 97 ms
24,372 KB
testcase_12 AC 102 ms
23,568 KB
testcase_13 AC 98 ms
24,084 KB
testcase_14 AC 103 ms
23,556 KB
testcase_15 AC 102 ms
24,384 KB
testcase_16 AC 99 ms
23,532 KB
testcase_17 AC 102 ms
24,336 KB
testcase_18 AC 99 ms
24,084 KB
testcase_19 AC 103 ms
23,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

// サンプルプログラム
// 質問クエリ
int ask(int x, int y, int z) {
    int d;
    cout << "?" << " " << x << " " << y << " " << z << endl;
    cin >> d;
    return d;
}

// 回答クエリ
void answer(int x, int y, int z) {
    cout << "!" << " " << x << " " << y << " " << z << endl;
}
// より

typedef array<int, 3> P;
int ask2(P p) { return ask(p[0], p[1], p[2]); }
void answer2(P p) { return answer(p[0], p[1], p[2]); }

int f(int l, int r, int k, P p) {
    if (r - l == 1)return l;
    p[k] = l-150;
    int dl, dr;
    dl = ask2(p);
    p[k] = r - 151;
    dr = ask2(p);
    int m = (l + r) / 2;
    return (dl < dr ? f(l, m, k, p) : f(m, r, k, p));
}

int main(){
    P p;
    p[0] = p[1] = p[2] = 0;
    
    rep(i, 3) {
        p[i] = f(0, 301, i, p) - 150;
    }
    answer2(p);
}
0