結果

問題 No.594 壊れた宝物発見機
ユーザー どららどらら
提出日時 2017-11-10 23:44:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 1,521 bytes
コンパイル時間 1,395 ms
コンパイル使用メモリ 163,744 KB
実行使用メモリ 24,312 KB
平均クエリ数 80.40
最終ジャッジ日時 2023-09-23 14:57:42
合計ジャッジ時間 4,818 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
23,412 KB
testcase_01 AC 102 ms
23,676 KB
testcase_02 AC 104 ms
23,448 KB
testcase_03 AC 101 ms
24,240 KB
testcase_04 AC 101 ms
23,568 KB
testcase_05 AC 102 ms
24,252 KB
testcase_06 AC 100 ms
23,772 KB
testcase_07 AC 102 ms
23,856 KB
testcase_08 AC 102 ms
23,772 KB
testcase_09 AC 103 ms
23,412 KB
testcase_10 AC 101 ms
23,760 KB
testcase_11 AC 100 ms
24,312 KB
testcase_12 AC 99 ms
23,412 KB
testcase_13 AC 98 ms
23,940 KB
testcase_14 AC 100 ms
23,304 KB
testcase_15 AC 103 ms
23,568 KB
testcase_16 AC 101 ms
23,448 KB
testcase_17 AC 100 ms
23,448 KB
testcase_18 AC 104 ms
23,448 KB
testcase_19 AC 104 ms
23,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

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 main(){
  int MN = -110;
  int MX = 110;
  
  int x, y, z;
  {
    double l=MN, r=MX;
    int lbd = ask(l, MN, MN);
    int ubd = ask(r, MN, MN);
    while(true){
      double a = (l+l+r)/3;
      double b = (l+r+r)/3;
      if((int)a == (int)b){
        x = (int)a;
        break;
      }
      if(ask(a,MN,MN)<ask(b,MN,MN)) r = b;
      else l = a;
    }
  }
  {
    double l=MN, r=MX;
    int lbd = ask(MN, l, MN);
    int ubd = ask(MN, r, MN);
    while(true){
      double a = (l+l+r)/3;
      double b = (l+r+r)/3;
      if((int)a == (int)b){
        y = (int)a;
        break;
      }
      if(ask(MN,a,MN)<ask(MN,b,MN)) r = b;
      else l = a;
    }
  }
  {
    double l=MN, r=MX;
    int lbd = ask(MN, MN, l);
    int ubd = ask(MN, MN, r);
    while(true){
      double a = (l+l+r)/3;
      double b = (l+r+r)/3;
      if((int)a == (int)b){
        z = (int)a;
        break;
      }
      if(ask(MN,MN,a)<ask(MN,MN,b)) r = b;
      else l = a;
    }
  }
  
  answer(x,y,z);
  return 0;
}
0