結果

問題 No.594 壊れた宝物発見機
ユーザー dnishdnish
提出日時 2018-06-23 10:31:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,122 bytes
コンパイル時間 1,409 ms
コンパイル使用メモリ 167,592 KB
実行使用メモリ 24,456 KB
平均クエリ数 75.30
最終ジャッジ日時 2023-09-23 16:06:05
合計ジャッジ時間 5,027 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 96 ms
24,300 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(int i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod= 1e10;

int x,y,z,D1,D2;
int main(){

    int lb=-101,ub=100;
    while(ub-lb>3){
        int mid1=(lb * 2 + ub) / 3; //三等分して左を選ぶ
        int mid2=(lb + ub * 2) / 3; //三等分して右を選ぶ
        cout<<"? "<<mid1<<" "<<y<<" "<<z<<endl;
        cin>>D1;
        cout<<"? "<<mid2<<" "<<y<<" "<<z<<endl;
        cin>>D2;
        if(D1 > D2) lb=mid1; //左側の領域を捨てる
        else ub = mid2;
    }
    int mn=500;
    REP(i,lb,lb+3){
        cout<<"? "<<i<<" "<<y<<" "<<z<<endl;
        cin>>D1;
        if(mn>D1){
            x=i;
            mn=D1;
        }
    }
    lb=-101,ub=100;
    while(ub-lb>3){
        int mid1=(lb * 2 + ub) / 3; //三等分して左を選ぶ
        int mid2=(lb + ub * 2) / 3; //三等分して右を選ぶ
        cout<<"? "<<x<<" "<<mid1<<" "<<z<<endl;
        cin>>D1;
        cout<<"? "<<x<<" "<<mid2<<" "<<z<<endl;
        cin>>D2;
        if(D1 > D2) lb=mid1; //左側の領域を捨てる
        else ub = mid2;
    }
    mn=500;
    REP(i,lb,lb+3){
        cout<<"? "<<x<<" "<<i<<" "<<z<<endl;
        cin>>D1;
        if(mn>D1){
            y=i;
            mn=D1;
        }
    }
    lb=-101,ub=100;
    while(ub-lb>3){
        int mid1=(lb * 2 + ub) / 3; //三等分して左を選ぶ
        int mid2=(lb + ub * 2) / 3; //三等分して右を選ぶ
        cout<<"? "<<x<<" "<<y<<" "<<mid1<<endl;
        cin>>D1;
        cout<<"? "<<x<<" "<<y<<" "<<mid2<<endl;
        cin>>D2;
        if(D1 > D2) lb=mid1; //左側の領域を捨てる
        else ub = mid2;
    }
    mn=500;
    REP(i,lb,lb+3){
        cout<<"? "<<x<<" "<<y<<" "<<i<<endl;
        cin>>D1;
        if(mn>D1){
            z=i;
            mn=D1;
        }
    }
    cout<<"! "<<x<<" "<<y<<" "<<z<<endl;
    return 0;
}
0