結果
問題 |
No.594 壊れた宝物発見機
|
ユーザー |
|
提出日時 | 2017-11-13 00:15:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,394 bytes |
コンパイル時間 | 1,667 ms |
コンパイル使用メモリ | 166,340 KB |
実行使用メモリ | 43,936 KB |
最終ジャッジ日時 | 2024-07-16 15:30:39 |
合計ジャッジ時間 | 7,877 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; int ask(int x, int y, int z){ cout << "? " << x << ' ' << y << ' ' << z << endl; int d; cin >> d; return d; } int fix_x(int xa, int xb, int y, int z){ while (xa < xb){ int x1 = xa + (xb - xa)/3; int x2 = xb - (xb - xa)/3; int d1 = ask(x1, y, z); int d2 = ask(x2, y, z); if (d1 > d2){ xa = x1; }else{ xb = x2; } } return xa; } int fix_y(int x, int ya, int yb, int z){ while (ya < yb){ int y1 = ya + (yb - ya)/3; int y2 = yb - (yb - ya)/3; int d1 = ask(x, y1, z); int d2 = ask(x, y2, z); if (d1 > d2){ ya = y1; }else{ yb = y2; } } return ya; } int fix_z(int x, int y, int za, int zb){ while (za < zb){ int z1 = za + (zb - za)/3; int z2 = zb - (zb - za)/3; int d1 = ask(x, y, z1); int d2 = ask(x, y, z2); if (d1 > d2){ za = z1; }else{ zb = z2; } } return za; } int main(){ int xa = -150; int xb = 150; int ya = -150; int yb = 150; int za = -150; int zb = 150; int x = fix_x(xa, xb, 0, 0); int y = fix_y(x, ya, yb, 0); int z = fix_z(x, y, za, zb); cout << "! " << x << ' ' << y << ' ' << z << endl; return 0; }