結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
kosakkun
|
| 提出日時 | 2017-05-09 17:38:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,182 bytes |
| コンパイル時間 | 778 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2024-07-16 13:37:38 |
| 合計ジャッジ時間 | 3,964 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:30:5: warning: 'dist' is used uninitialized [-Wuninitialized]
30 | if(dist == 0) return 0;
| ^~
main.cpp:28:9: note: 'dist' was declared here
28 | int dist;
| ^~~~
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
typedef long long ll;
int dist;
int judge(int x, int y){
cout << x << " " << y << endl;
cin >> dist;
return dist;
}
int main(){
int dist;
judge(0,0);
if(dist == 0) return 0;
int x_low = 0, x_high = 100000;
while(x_high - x_low > 1){
int mid=(x_low + x_high) / 2;
int dist_t = judge(mid,0);
if(dist_t == 0) return 0;
else if(dist_t < dist) x_low = mid;
else x_high = mid;
}
int y_low = 0, y_high = 100000;
while(y_high - y_low > 1){
int mid=(y_low + y_high) / 2;
int dist_t = judge(0,mid);
if(dist_t == 0) return 0;
else if(dist_t < dist) y_low = mid;
else y_high = mid;
}
judge(x_low,y_low);
return 0;
}
kosakkun