結果
問題 |
No.594 壊れた宝物発見機
|
ユーザー |
|
提出日時 | 2017-11-10 22:39:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,161 bytes |
コンパイル時間 | 1,818 ms |
コンパイル使用メモリ | 168,788 KB |
実行使用メモリ | 43,940 KB |
最終ジャッジ日時 | 2024-07-16 15:28:15 |
合計ジャッジ時間 | 8,443 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 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 (miny == yinf) { yinf = (yinf + ysup) / 2; } if (minz == zinf) { zsup = (zinf + zsup) / 2; } else if (minz == zinf) { zinf = (zinf + zsup) / 2; } } cout << "! " << xinf << " " << yinf << " " << zinf << endl; return 0; }