結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
aim_cpo
|
| 提出日時 | 2018-02-26 01:49:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,920 bytes |
| コンパイル時間 | 1,744 ms |
| コンパイル使用メモリ | 167,692 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 32.92 |
| 最終ジャッジ日時 | 2024-07-16 15:37:00 |
| 合計ジャッジ時間 | 4,364 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int minx=0,maxx=100000;
cout<<minx<<" "<<0<<"\n";
int d1;cin>>d1;
if(d1==0)return 0;
cout<<maxx<<" "<<0<<"\n";
int d2;cin>>d2;
if(d2==0)return 0;
int leftdis=0,rightdis=0;
if(d1>=d2){
minx=(minx+maxx)/2;
leftdis=0;
rightdis=d2;
}else{
maxx=(minx+maxx)/2;
leftdis=d1;
rightdis=0;
}
while(maxx-minx>1){
int mid=(minx+maxx)/2;
cout<<mid<<" "<<0<<"\n";
int d;cin>>d;
if(d==0)return 0;
if(leftdis==0){
leftdis=d;
if(leftdis>rightdis){
leftdis=0;
minx=mid;
}else{
rightdis=0;
maxx=mid;
}
}else{
rightdis=d;
if(leftdis>rightdis){
leftdis=0;
minx=mid;
}else{
rightdis=0;
maxx=mid;
}
}
}
int resx=0;
cout<<minx<<" "<<0<<"\n";
cin>>d1;
if(d1==0)return 0;
cout<<maxx<<" "<<0<<"\n";
cin>>d2;
if(d2==0)return 0;
if(d1>d2)resx=maxx;
else resx=minx;
int miny=0,maxy=100000;
cout<<resx<<" "<<miny<<"\n";
d1;cin>>d1;
if(d1==0)return 0;
cout<<resx<<" "<<miny<<"\n";
d2;cin>>d2;
if(d2==0)return 0;
leftdis=0,rightdis=0;
if(d1>=d2){
miny=(miny+maxy)/2;
leftdis=0;
rightdis=d2;
}else{
maxy=(miny+maxy)/2;
leftdis=d1;
rightdis=0;
}
while(maxy-miny>1){
int mid=(miny+maxy)/2;
cout<<resx<<" "<<mid<<"\n";
int d;cin>>d;
if(d==0)return 0;
if(leftdis==0){
leftdis=d;
if(leftdis>rightdis){
leftdis=0;
miny=mid;
}else{
rightdis=0;
maxy=mid;
}
}else{
rightdis=d;
if(leftdis>rightdis){
leftdis=0;
miny=mid;
}else{
rightdis=0;
maxy=mid;
}
}
}
int resy=0;
cout<<resx<<" "<<miny<<"\n";
cin>>d1;
if(d1==0)return 0;
cout<<resx<<" "<<maxy<<"\n";
cin>>d2;
if(d2==0)return 0;
return 0;
}
aim_cpo