結果

問題 No.513 宝探し2
ユーザー tanimani364tanimani364
提出日時 2021-03-11 15:07:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,380 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 199,692 KB
実行使用メモリ 24,396 KB
平均クエリ数 129.67
最終ジャッジ日時 2023-09-24 09:56:00
合計ジャッジ時間 5,195 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 30 ms
24,288 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
#define fi first
#define se second
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

//using lll=boost::multiprecision::cpp_int;
//using Double=boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1024>>;//仮数部が1024桁
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

template <typename T>
T mypow(T x, T n, const T &p = -1)
{ //x^nをmodで割った余り

	if(p!=-1){
		x%=p;
	}
	T ret = 1;
	while (n > 0)
	{
		if (n & 1)
		{
			if (p != -1)
				ret = (ret * x) % p;
			else
				ret *= x;
		}
		if (p != -1)
			x = (x * x) % p;
		else
			x *= x;
		n >>= 1;
	}
	return ret;
}

using namespace std;
//using namespace atcoder;

int ansx,ansy;

void query(int x,int y){
	cout<<x<<" "<<y<<endl;
	//return abs(ansx-x)+abs(ansy-y);
}
void solve()
{	
	ansx=8001,ansy=0;
	int l=0,r=100000;
	int x,y=100000;
	while(r-l>2){
		int lx=(l*2+r)/3,rx=(r*2+l)/3;
		int dis1,dis2;
		query(lx,y);
		cin>>dis1;
		if(!dis1)return;
		query(rx,y);
		cin>>dis2;
		if(!dis2)return;
		if(dis1>dis2){
			l=lx;
			x=r;
		}
		else{
			x=l;
			r=rx;
		}
		x=lx;
	}
	
	l=0,r=100001;
	while(r-l>2){
		int ly=(l*2+r)/3,ry=(r*2+l)/3;
		int dis1,dis2;
		query(x,ly);
		cin>>dis1;
		if(!dis1)return;
		query(x,ry);
		cin>>dis2;
		if(!dis2)return;
		if(dis1>dis2){
			l=ly;
		}
		else{
			r=ry;
		}
		y=ly;
	}

	for(int i=-2;i<=2;++i){
		for(int j=-2;j<=2;++j){
			query(x+i,y+j);
			int dis;
			cin>>dis;
			if(!dis)return;
		}
	}
}

int main()
{
	// ios::sync_with_stdio(false);
	// cin.tie(nullptr);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}
0