結果

問題 No.594 壊れた宝物発見機
ユーザー treeonetreeone
提出日時 2017-11-10 23:09:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,723 bytes
コンパイル時間 1,393 ms
コンパイル使用メモリ 144,776 KB
実行使用メモリ 24,420 KB
平均クエリ数 121.00
最終ジャッジ日時 2023-09-23 14:51:08
合計ジャッジ時間 4,493 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 105 ms
23,412 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

// 質問クエリ
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;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[3] = {10, 10, 10};
	
    
    int l = -150, r = 150;
    rep(i, 0, 20){
        int m1 = (l * 2 + r) / 3;
        int m2 = (l + 2 * r) / 3;
        int tmp1, tmp2;
        tmp1 = ask(m1, a[1], a[2]);
        tmp2 = ask(m2, a[1], a[2]);
        if(tmp1 < tmp2){
            r = m2;
        }else{
            l = m1;
        }
    }
    a[0] = l;
    l = -150, r = 150;
    rep(i, 0, 20){
        int m1 = (l * 2 + r) / 3;
        int m2 = (l + 2 * r) / 3;
        int tmp1, tmp2;
        tmp1 = ask(a[0], m1, a[2]);
        tmp2 = ask(a[0], m2, a[2]);
        if(tmp1 < tmp2){
            r = m2;
        }else{
            l = m1;
        }
    }
    a[1] = l;
    l = -150, r = 150;
    rep(i, 0, 20){
        int m1 = (l * 2 + r) / 3;
        int m2 = (l + 2 * r) / 3;
        int tmp1, tmp2;
        tmp1 = ask(a[0], a[1], m1);
        tmp2 = ask(a[0], a[1], m2);
        if(tmp1 < tmp2){
            r = m2;
        }else{
            l = m1;
        }
    }
    a[2] = l;
	answer(a[0], a[1], a[2]);
	return 0;
}
0