結果
問題 | No.594 壊れた宝物発見機 |
ユーザー | stone_725 |
提出日時 | 2018-01-25 11:56:46 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,808 bytes |
コンパイル時間 | 2,457 ms |
コンパイル使用メモリ | 212,268 KB |
実行使用メモリ | 44,580 KB |
最終ジャッジ日時 | 2024-07-16 15:32:53 |
合計ジャッジ時間 | 8,926 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
コンパイルメッセージ
main.cpp: In function 'void hawawa()': main.cpp:69:5: warning: 'mininfo[2]' may be used uninitialized [-Wmaybe-uninitialized] 69 | if (mininfo[2]) { | ^~ main.cpp:45:9: note: 'mininfo[2]' was declared here 45 | int mininfo[3]; | ^~~~~~~ main.cpp:64:5: warning: 'mininfo[1]' may be used uninitialized [-Wmaybe-uninitialized] 64 | if (mininfo[1]) { | ^~ main.cpp:45:9: note: 'mininfo[1]' was declared here 45 | int mininfo[3]; | ^~~~~~~ main.cpp:59:5: warning: 'mininfo[0]' may be used uninitialized [-Wmaybe-uninitialized] 59 | if (mininfo[0]) { | ^~ main.cpp:45:9: note: 'mininfo[0]' was declared here 45 | int mininfo[3]; | ^~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; static const int INF = 1e9 + 7; template<typename T> using Vec = vector<T>; template<typename T, typename T2> using P = pair<T, T2>; template<typename... Args> using Tup = tuple<Args...>; using llong = long long; using ullong = unsigned long long; using uint = unsigned int; map<Tup<short, short, short>, llong> d; llong ask(short x, short y, short z) { auto status = make_tuple(x, y, z); if (d.count(status)) return d[status]; cout << "? " << x << " " << y << " " << z << endl; cout.flush(); int res; cin >> res; return d[status] = res; } void ans(short x, short y, short z) { cout << "! " << x << " " << y << " " << z << endl; cout.flush(); } void hawawa() { short xinfo[] = { -100, 100 }; short yinfo[] = { -100, 100 }; short zinfo[] = { -100, 100 }; while (xinfo[0] < xinfo[1] || yinfo[0] < yinfo[1] || zinfo[0] < zinfo[1]) { int mininfo[3]; llong mn = LLONG_MAX; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { if (mn > ask(xinfo[i], yinfo[j], zinfo[k])) { mn = ask(xinfo[i], yinfo[j], zinfo[k]); mininfo[0] = i; mininfo[1] = j; mininfo[2] = k; } } } } if (mininfo[0]) { xinfo[0] = (xinfo[0] + xinfo[1] + 1) / 2; } else { xinfo[1] = (xinfo[0] + xinfo[1]) / 2; } if (mininfo[1]) { yinfo[0] = (yinfo[0] + yinfo[1] + 1) / 2; } else { yinfo[1] = (yinfo[0] + yinfo[1]) / 2; } if (mininfo[2]) { zinfo[0] = (zinfo[0] + zinfo[1] + 1) / 2; } else { zinfo[0] = (zinfo[0] + zinfo[1]) / 2; } } ans(xinfo[0], yinfo[0], zinfo[0]); } int main() { ios::sync_with_stdio(false); cin.tie(0); hawawa(); }