結果
| 問題 |
No.594 壊れた宝物発見機
|
| コンテスト | |
| ユーザー |
kosakkun
|
| 提出日時 | 2017-11-10 23:19:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,956 bytes |
| コンパイル時間 | 1,003 ms |
| コンパイル使用メモリ | 112,868 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 34.00 |
| 最終ジャッジ日時 | 2024-07-16 14:32:36 |
| 合計ジャッジ時間 | 4,844 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 20 |
ソースコード
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
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(void) {
bool dir1 = true;
bool dir2 = true;
bool dir3 = true;
int O = ask(0, 0, 0);
int Ox = ask(1, 0, 0);
int Oy = ask(0, 1, 0);
int Oz = ask(0, 0, 1);
if (O < Ox) dir1 = false;
if (O < Oy) dir2 = false;
if (O < Oz) dir3 = false;
int si1 = dir1 ? 1 : -1;
int x = 2 * si1;
int nx = ask(x, 0, 0);
while (Ox * si1 > nx * si1) {
Ox = nx;
x += 2 * si1;
}
int si2 = dir2 ? 1 : -1;
int y = 2 * si2;
int ny = ask(0, y, 0);
while (Oy * si2 > ny * si2) {
Oy = ny;
y += 2 * si2;
}
int si3 = dir3 ? 1 : -1;
int z = 2 * si3;
int nz = ask(0, 0, z);
while (Oz * si3 > nz * si3) {
Oz = nz;
z += 2 * si3;
}
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
for (int k = z - 1; k <= z + 1; k++) {
int d = ask(i, j, k);
if (d == 0) {
answer(i, j, k);
return 0;
}
}
}
}
return 0;
}
kosakkun