結果

問題 No.594 壊れた宝物発見機
ユーザー TangentDayTangentDay
提出日時 2017-11-10 22:42:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 1,376 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 74,428 KB
実行使用メモリ 24,276 KB
平均クエリ数 46.60
最終ジャッジ日時 2023-09-23 14:47:30
合計ジャッジ時間 4,094 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
24,024 KB
testcase_01 AC 112 ms
23,412 KB
testcase_02 AC 108 ms
23,964 KB
testcase_03 AC 108 ms
23,328 KB
testcase_04 AC 112 ms
23,364 KB
testcase_05 AC 106 ms
23,364 KB
testcase_06 AC 109 ms
23,604 KB
testcase_07 AC 107 ms
24,228 KB
testcase_08 AC 108 ms
23,412 KB
testcase_09 AC 109 ms
23,976 KB
testcase_10 AC 109 ms
24,024 KB
testcase_11 AC 107 ms
23,772 KB
testcase_12 AC 107 ms
23,784 KB
testcase_13 AC 106 ms
24,048 KB
testcase_14 AC 107 ms
23,460 KB
testcase_15 AC 106 ms
24,276 KB
testcase_16 AC 108 ms
24,048 KB
testcase_17 AC 108 ms
23,604 KB
testcase_18 AC 108 ms
23,592 KB
testcase_19 AC 109 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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;
}

int calc(int i){
    int l = -101, r = 101;
    while (r - l > 2){
        int m1 = (r - l) / 2 + l;
        int m2 = m1 + 1;
        int d1, d2;
        if (i == 0){
            d1 = ask(m1, 0, 0);
            d2 = ask(m2, 0, 0);
        }else if (i == 1){
            d1 = ask(0, m1, 0);
            d2 = ask(0, m2, 0);
        }else{
            d1 = ask(0, 0, m1);
            d2 = ask(0, 0, m2);
        }
        if (d1 < d2) r = m2;
        else l = m1;
    }
    return l + 1;
}

int main() {
    answer(calc(0), calc(1), calc(2));
    return 0;
}
0