結果

問題 No.594 壊れた宝物発見機
ユーザー wk1080idwk1080id
提出日時 2019-01-10 00:16:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 2,376 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 84,504 KB
実行使用メモリ 24,276 KB
平均クエリ数 102.75
最終ジャッジ日時 2023-09-23 16:43:07
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
24,060 KB
testcase_01 AC 110 ms
23,904 KB
testcase_02 AC 107 ms
23,616 KB
testcase_03 AC 104 ms
23,976 KB
testcase_04 AC 109 ms
23,628 KB
testcase_05 AC 106 ms
23,988 KB
testcase_06 AC 105 ms
23,340 KB
testcase_07 AC 107 ms
23,388 KB
testcase_08 AC 104 ms
23,604 KB
testcase_09 AC 106 ms
23,556 KB
testcase_10 AC 107 ms
23,604 KB
testcase_11 AC 109 ms
23,388 KB
testcase_12 AC 107 ms
23,244 KB
testcase_13 AC 104 ms
23,340 KB
testcase_14 AC 105 ms
24,276 KB
testcase_15 AC 102 ms
23,340 KB
testcase_16 AC 103 ms
23,892 KB
testcase_17 AC 105 ms
23,952 KB
testcase_18 AC 108 ms
24,264 KB
testcase_19 AC 103 ms
24,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}

pii f(int i, int j){
    int a = 1000*i/(i+j)+5;
    int b = 1000*j/(i+j)+5;
    return pii(a/10,b/10);
}

int f(int x, int y, int z){
    cout << "?" << " " << x << " " << y << " " << z << endl;
    int ret;
    cin >> ret;
    return ret;
}
signed main(void) {
    int x,y,z,lb,ub,t;
    x = y = z = 1;

    lb = -150, ub = 150;
    rep(_,15){
        int m1 = (lb+lb+ub)/3;
        int m2 = (lb+ub+ub)/3;
        int t1 = f(m1,y,z);
        int t2 = f(m2,y,z);
        if(t1 < t2) ub = m2;
        else lb = m1;
    }
    t = f(lb,y,z);
    loop(i,lb,ub+1){
        int tmp = f(i,y,z);
        if(t > tmp){
            t = tmp;
            lb = i;
        }
    }
    x = lb;

    lb = -150, ub = 150;
    rep(_,15){
        int m1 = (lb+lb+ub)/3;
        int m2 = (lb+ub+ub)/3;
        int t1 = f(x,m1,z);
        int t2 = f(x,m2,z);
        if(t1 < t2) ub = m2;
        else lb = m1;
    }
    t = f(x,lb,z);
    loop(i,lb,ub+1){
        int tmp = f(x,i,z);
        if(t > tmp){
            t = tmp;
            lb = i;
        }
    }
    y = lb;

    lb = -150, ub = 150;
    rep(_,15){
        int m1 = (lb+lb+ub)/3;
        int m2 = (lb+ub+ub)/3;
        int t1 = f(x,y,m1);
        int t2 = f(x,y,m2);
        if(t1 < t2) ub = m2;
        else lb = m1;
    }
    t = f(x,y,lb);
    loop(i,lb,ub+1){
        int tmp = f(x,y,i);
        if(t > tmp){
            t = tmp;
            lb = i;
        }
    }
    z = lb;

    cout << "!" << " " << x << " " << y << " " << z << endl;
}
0