結果

問題 No.594 壊れた宝物発見機
ユーザー treeonetreeone
提出日時 2017-11-10 23:08:12
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,811 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 144,576 KB
実行使用メモリ 43,684 KB
最終ジャッジ日時 2023-09-23 15:43:29
合計ジャッジ時間 7,525 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
        ask(m1, a[1], a[2]);
        cin >> tmp1;
        ask(m2, a[1], a[2]);
        cin >> tmp2;
        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;
        ask(a[0], m1, a[2]);
        cin >> tmp1;
        ask(a[0], m2, a[2]);
        cin >> tmp2;
        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;
        ask(a[0], a[1], m1);
        cin >> tmp1;
        ask(a[0], a[1], m2);
        cin >> tmp2;
        if(tmp1 < tmp2){
            r = m2;
        }else{
            l = m1;
        }
    }
    a[2] = l;
	answer(a[0], a[1], a[2]);    
	return 0;
}
0