結果
問題 | No.513 宝探し2 |
ユーザー |
![]() |
提出日時 | 2017-05-05 23:13:48 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,409 bytes |
コンパイル時間 | 1,739 ms |
コンパイル使用メモリ | 160,336 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 83.00 |
最終ジャッジ日時 | 2024-07-16 13:22:56 |
合計ジャッジ時間 | 3,937 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:37:9: warning: ‘p’ may be used uninitialized in this function [-Wmaybe-uninitialized] 37 | switch (p) { | ^~~~~~
ソースコード
#include<bits/stdc++.h>#define range(i,a,b) for(int i = (a); i < (b); i++)#define rep(i,b) for(int i = 0; i < (b); i++)#define all(a) (a).begin(), (a).end()#define show(x) cerr << #x << " = " << (x) << endl;using namespace std;const int MAX = 100000;const int dy[16] = { 1,-1, 1,-1, 0,-2, 0, 2};const int dx[16] = { 1, 1,-1,-1, 2, 0,-2, 0};int main(){int x, y;int x_right = MAX, x_left = 0;int y_right = MAX, y_left = 0;rep(i,25){x = (x_right + x_left) / 2;y = (y_right + y_left) / 2;int mini = MAX * 3;int p;rep(j,4){cout << x + dx[j] << ' ' << y + dy[j] << endl;int tmp;cin >> tmp;if(tmp == 0){cout << x + dx[j] << ' ' << y + dy[j] << endl;return 0;}if(mini > tmp){mini = tmp;p = j;}}switch (p) {case 0:x_left = x;y_left = y;break;case 1:x_left = x;y_right = y;break;case 2:x_right = x;y_left = y;break;case 3:x_right = x;y_right = y;break;}}cout << x << ' ' << y << endl;}