結果
| 問題 | No.594 壊れた宝物発見機 |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2017-11-13 12:00:33 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,390 bytes |
| 記録 | |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 83,920 KB |
| 実行使用メモリ | 25,856 KB |
| 平均クエリ数 | 73.00 |
| 最終ジャッジ日時 | 2024-07-16 14:50:32 |
| 合計ジャッジ時間 | 3,910 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:56:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
56 | scanf("%d", &d);
| ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 594.cc: No.594 壊れた宝物発見機 - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int MAX_N = 100;
const int MIN_X = -150, MIN_Y = -150, MIN_Z = -150;
const int MAX_X = 150, MAX_Y = 150, MAX_Z = 150;
const int INF = 1 << 30;
/* typedef */
/* global variables */
/* subroutines */
/* main */
int main() {
int x0 = MIN_X, y0 = MIN_Y, z0 = MIN_Z;
int x1 = MAX_X + 1, y1 = MAX_Y + 1, z1 = MAX_Z + 1;
while (x0 + 1 < x1) {
int mind = INF, mini = -1;
for (int i = 0; i < 8; i++) {
int x = (i & 1) ? x1 : x0;
int y = (i & 2) ? y1 : y0;
int z = (i & 4) ? z1 : z0;
printf("? %d %d %d\n", x, y, z); fflush(stdout);
int d;
scanf("%d", &d);
if (mind > d) mind = d, mini = i;
}
int hx = (x0 + x1) / 2;
int hy = (y0 + y1) / 2;
int hz = (z0 + z1) / 2;
if (mini & 1) x0 = hx;
else x1 = hx;
if (mini & 2) y0 = hy;
else y1 = hy;
if (mini & 4) z0 = hz;
else z1 = hz;
}
printf("! %d %d %d\n", x1, y1, z1); fflush(stdout);
return 0;
}
tnakao0123