結果

問題 No.594 壊れた宝物発見機
ユーザー どららどらら
提出日時 2017-11-10 23:26:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,495 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 164,800 KB
実行使用メモリ 24,420 KB
平均クエリ数 97.00
最終ジャッジ日時 2023-09-23 14:55:12
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 113 ms
24,336 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:71:9: 警告: ‘z’ is used uninitialized [-Wuninitialized]
   71 |   answer(x,y,z);
      |   ~~~~~~^~~~~~~
main.cpp:24:13: 備考: ‘z’ はここで定義されています
   24 |   int x, y, z;
      |             ^

ソースコード

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

0