結果
問題 | No.594 壊れた宝物発見機 |
ユーザー |
![]() |
提出日時 | 2017-11-10 22:40:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 1,380 bytes |
コンパイル時間 | 1,656 ms |
コンパイル使用メモリ | 168,100 KB |
実行使用メモリ | 25,604 KB |
平均クエリ数 | 82.00 |
最終ジャッジ日時 | 2024-07-16 14:26:31 |
合計ジャッジ時間 | 4,992 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = long long; using P = std::tuple<int,int>; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; int ask(int x, int y, int z) { int d; cout << "?" << " " << x << " " << y << " " << z << endl; // d = abs(x) + abs(y) + abs(z) + 80; cin >> d; return d; } void answer(int x, int y, int z) { cout << "!" << " " << x << " " << y << " " << z << endl; } int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int x[3] = {0, 0, 0}; for(int i=0;i<3;++i){ int lb = -150, ub = 151; while(ub - lb > 2){ int m1 = (2 * lb + ub) / 3, m2 = (lb + 2 * ub) / 3; x[i] = m1; int d1 = ask(x[0], x[1], x[2]); x[i] = m2; int d2 = ask(x[0], x[1], x[2]); if(d1 < d2){ ub = m2; }else{ lb = m1; } } x[i] = lb; int d1 = ask(x[0], x[1], x[2]); x[i] = lb + 1; int d2 = ask(x[0], x[1], x[2]); if(d1 < d2){ x[i] = lb; }else{ x[i] = lb + 1; } } answer(x[0], x[1], x[2]); }