結果
問題 | No.594 壊れた宝物発見機 |
ユーザー | Pachicobue |
提出日時 | 2017-11-10 22:39:09 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,161 bytes |
コンパイル時間 | 1,398 ms |
コンパイル使用メモリ | 167,344 KB |
実行使用メモリ | 41,076 KB |
最終ジャッジ日時 | 2024-07-16 15:28:06 |
合計ジャッジ時間 | 7,773 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 'int main()': main.cpp:85:9: warning: 'minz' may be used uninitialized [-Wmaybe-uninitialized] 85 | if (minz == zinf) { | ^~ main.cpp:59:13: note: 'minz' was declared here 59 | int minz; | ^~~~ main.cpp:80:9: warning: 'miny' may be used uninitialized [-Wmaybe-uninitialized] 80 | if (miny == yinf) { | ^~ main.cpp:58:13: note: 'miny' was declared here 58 | int miny; | ^~~~ main.cpp:75:9: warning: 'minx' may be used uninitialized [-Wmaybe-uninitialized] 75 | if (minx == xinf) { | ^~ main.cpp:57:13: note: 'minx' was declared here 57 | int minx; | ^~~~
ソースコード
#include <bits/stdc++.h> #define show(x) cerr << #x << " = " << x << endl using namespace std; using ll = long long; template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "sz:" << v.size() << "\n["; for (const auto& p : v) { os << p << ","; } os << "]\n"; return os; } template <typename S, typename T> ostream& operator<<(ostream& os, const pair<S, T>& p) { os << "(" << p.first << "," << p.second << ")"; return os; } constexpr ll MOD = (ll)1e9 + 7LL; template <typename T> constexpr T INF = numeric_limits<T>::max() / 64; ll ask(const int x, const int y, const int z) { cout << "? " << x << " " << y << " " << z << endl; ll i; cin >> i; return i; } int main() { cin.tie(0); ios::sync_with_stdio(false); int xinf = -100; int xsup = 100; int yinf = -100; int ysup = 100; int zinf = -100; int zsup = 100; while (true) { if (xinf == xsup and yinf == ysup and zinf == zsup) { break; } int minx; int miny; int minz; int mini = 10000; for (int i = 0; i < 2; i++) { const int x = (i == 0) ? xinf : xsup; for (int j = 0; j < 2; j++) { const int y = (i == 0) ? yinf : ysup; for (int k = 0; k < 2; k++) { const int z = (i == 0) ? zinf : zsup; if (ask(x, y, z) < mini) { minx = x; miny = y; minz = z; } } } } if (minx == xinf) { xsup = (xinf + xsup) / 2; } else if (minx == xinf) { xinf = (xinf + xsup) / 2; } if (miny == yinf) { ysup = (yinf + ysup) / 2; } else if (minx == xinf) { yinf = (yinf + ysup) / 2; } if (minz == zinf) { zsup = (zinf + zsup) / 2; } else if (minx == xinf) { zinf = (zinf + zsup) / 2; } } cout << "! " << xinf << " " << yinf << " " << zinf << endl; return 0; }