結果

問題 No.594 壊れた宝物発見機
ユーザー ei1333333ei1333333
提出日時 2017-11-10 22:31:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 2,099 ms
コンパイル使用メモリ 197,632 KB
実行使用メモリ 24,444 KB
平均クエリ数 50.80
最終ジャッジ日時 2023-09-23 14:45:13
合計ジャッジ時間 5,575 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 101 ms
23,472 KB
testcase_16 AC 98 ms
23,592 KB
testcase_17 AC 104 ms
23,316 KB
testcase_18 AC 105 ms
23,352 KB
testcase_19 AC 102 ms
23,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;


// 質問クエリ
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 findMaximal(int from, int to, int v)
{
  for(; to - from > 1;) {
    int mid = (from + to) / 2;
    if(v == 0) (ask(mid, 0, 0) - ask(mid - 1, 0, 0) < 0 ? from : to) = mid;
    else if(v == 1)(ask(0, mid, 0) - ask(0, 0, mid - 1) < 0 ? from : to) = mid;
    else (ask(0, 0, mid) - ask(0, 0, mid - 1) < 0 ? from : to) = mid;
  }
  return from;
}

int main(void)
{
  answer(findMaximal(-150, 151, 0), findMaximal(-150, 151, 1), findMaximal(-150, 151, 2));
}

0