結果

問題 No.594 壊れた宝物発見機
ユーザー Kutimoti_TKutimoti_T
提出日時 2018-06-04 20:03:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 2,032 bytes
コンパイル時間 1,703 ms
コンパイル使用メモリ 162,016 KB
実行使用メモリ 25,232 KB
平均クエリ数 75.80
最終ジャッジ日時 2024-07-16 15:50:55
合計ジャッジ時間 4,693 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
25,232 KB
testcase_01 AC 108 ms
25,220 KB
testcase_02 AC 110 ms
24,836 KB
testcase_03 AC 104 ms
25,220 KB
testcase_04 AC 107 ms
25,220 KB
testcase_05 AC 102 ms
24,836 KB
testcase_06 AC 101 ms
25,220 KB
testcase_07 AC 110 ms
25,220 KB
testcase_08 AC 102 ms
24,964 KB
testcase_09 AC 98 ms
25,232 KB
testcase_10 AC 101 ms
24,848 KB
testcase_11 AC 100 ms
24,592 KB
testcase_12 AC 102 ms
24,976 KB
testcase_13 AC 100 ms
25,232 KB
testcase_14 AC 102 ms
25,232 KB
testcase_15 AC 105 ms
24,592 KB
testcase_16 AC 102 ms
25,232 KB
testcase_17 AC 101 ms
25,232 KB
testcase_18 AC 103 ms
24,592 KB
testcase_19 AC 103 ms
24,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:86:43: warning: ‘Z’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   86 |   cout << "! " << X << " " << Y << " " << Z << endl;
      |                                           ^
main.cpp:86:36: warning: ‘Y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   86 |   cout << "! " << X << " " << Y << " " << Z << endl;
      |                                    ^~~
main.cpp:86:24: warning: ‘X’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   86 |   cout << "! " << X << " " << Y << " " << Z << endl;
      |                        ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int main(){
  int X,Y,Z;
  {
    int x0 = -100;
    int x3 = 100;
    i64 f1 = 1LL << 60;
    i64 f2 = 0;
    while(x3 - x0 > 10){
      int x1 = (x0 * 2 + x3 * 1) / (1 + 2);
      int x2 = (x0 * 1 + x3 * 2) / (1 + 2);
      cout << "? " << x1 << " " << 0 << " " << 0 << endl;
      cin >> f1;
      cout << "? " << x2 << " " << 0 << " " << 0 << endl;
      cin >> f2;
      if(f1 >= f2){
        x0 = x1;
      }
      else{
        x3 = x2;
      }
    }
    i64 MIN = 1LL << 60;
    for(int i = x0;i <= x3;i++){
      cout << "? " << i << " " << 0 << " " << 0 << endl;
      cin >> f1;
      if(f1 < MIN) X = i,MIN = f1;
    }
  }
  {
    int x0 = -100;
    int x3 = 100;
    i64 f1 = 1LL << 60;
    i64 f2 = 0;
    while(x3 - x0 > 10){
      int x1 = (x0 * 2 + x3 * 1) / (1 + 2);
      int x2 = (x0 * 1 + x3 * 2) / (1 + 2);
      cout << "? " << 0 << " " << x1 << " " << 0 << endl;
      cin >> f1;
      cout << "? " << 0 << " " << x2 << " " << 0 << endl;
      cin >> f2;
      if(f1 >= f2){
        x0 = x1;
      }
      else{
        x3 = x2;
      }
    }
    i64 MIN = 1LL << 60;
    for(int i = x0;i <= x3;i++){
      cout << "? " << 0 << " " << i << " " << 0 << endl;
      cin >> f1;
      if(f1 < MIN) Y = i,MIN = f1;
    }
  }
  {
    int x0 = -100;
    int x3 = 100;
    i64 f1 = 1LL << 60;
    i64 f2 = 0;
    while(x3 - x0 > 10){
      int x1 = (x0 * 2 + x3 * 1) / (1 + 2);
      int x2 = (x0 * 1 + x3 * 2) / (1 + 2);
      cout << "? " << 0 << " " << 0 << " " << x1 << endl;
      cin >> f1;
      cout << "? " << 0 << " " << 0 << " " << x2 << endl;
      cin >> f2;
      if(f1 >= f2){
        x0 = x1;
      }
      else{
        x3 = x2;
      }
    }
    i64 MIN = 1LL << 60;
    for(int i = x0;i <= x3;i++){
      cout << "? " << 0 << " " << 0 << " " << i << endl;
      cin >> f1;
      if(f1 < MIN) Z = i,MIN = f1;
    }
  }
  cout << "! " << X << " " << Y << " " << Z << endl;
}
0