結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
peroon
|
| 提出日時 | 2019-06-13 15:08:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,703 bytes |
| コンパイル時間 | 1,784 ms |
| コンパイル使用メモリ | 167,696 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 26.17 |
| 最終ジャッジ日時 | 2024-07-16 17:13:11 |
| 合計ジャッジ時間 | 3,850 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 7 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
const ll mod = 1e9 + 7;
const ll inf = 1e18;
void vprint(vector<ll> A){
ll L = A.size();
FOR(i, 0, L){
if(i) cout << ' ';
cout << A[i];
}
cout << endl;
}
ll query(ll x, ll y){
p2(x, y);
ll d;
cin >> d;
if(d==0) exit(0);
return d;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll left = 0;
ll left_d = query(left, 0);
ll right = 100000;
ll right_d = query(right, 0);
while(left+1!=right){
ll center = (left+right)/2;
ll d = query(center, 0);
ll assumed_center_d = left_d - (center-left);
if(assumed_center_d==d){
left = center;
}else{
right = center;
}
}
ll center_x = left;
// Y
left = 0;
left_d = query(center_x, left);
right = 100000;
right_d = query(center_x, right);
while(left+1!=right){
ll center = (left+right)/2;
ll d = query(center_x, center);
ll assumed_center_d = left_d - (center-left);
if(assumed_center_d==d){
left = center;
}else{
right = center;
}
}
return 0;
}
peroon