結果

問題 No.1152 10億ゲーム
ユーザー xllend3xllend3
提出日時 2020-08-07 23:04:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 5,516 bytes
コンパイル時間 1,667 ms
コンパイル使用メモリ 166,192 KB
実行使用メモリ 24,480 KB
平均クエリ数 26.00
最終ジャッジ日時 2023-09-24 04:55:37
合計ジャッジ時間 7,806 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
24,312 KB
testcase_01 AC 67 ms
24,096 KB
testcase_02 AC 68 ms
24,312 KB
testcase_03 AC 67 ms
23,436 KB
testcase_04 AC 68 ms
24,396 KB
testcase_05 AC 69 ms
24,024 KB
testcase_06 AC 70 ms
23,592 KB
testcase_07 AC 69 ms
23,688 KB
testcase_08 AC 67 ms
23,652 KB
testcase_09 AC 67 ms
23,640 KB
testcase_10 AC 67 ms
23,592 KB
testcase_11 AC 68 ms
24,024 KB
testcase_12 AC 68 ms
23,412 KB
testcase_13 AC 68 ms
24,108 KB
testcase_14 AC 68 ms
24,372 KB
testcase_15 AC 68 ms
23,544 KB
testcase_16 AC 67 ms
23,664 KB
testcase_17 AC 69 ms
24,480 KB
testcase_18 AC 69 ms
24,036 KB
testcase_19 AC 68 ms
24,024 KB
testcase_20 AC 69 ms
23,664 KB
testcase_21 AC 68 ms
23,688 KB
testcase_22 AC 67 ms
23,460 KB
testcase_23 AC 68 ms
23,712 KB
testcase_24 AC 68 ms
23,472 KB
testcase_25 AC 69 ms
23,652 KB
testcase_26 AC 69 ms
23,700 KB
testcase_27 AC 69 ms
23,712 KB
testcase_28 AC 68 ms
23,532 KB
testcase_29 AC 67 ms
24,060 KB
testcase_30 AC 68 ms
24,336 KB
testcase_31 AC 68 ms
24,336 KB
testcase_32 AC 67 ms
23,376 KB
testcase_33 AC 68 ms
23,412 KB
testcase_34 AC 69 ms
23,436 KB
testcase_35 AC 69 ms
24,384 KB
testcase_36 AC 67 ms
24,372 KB
testcase_37 AC 68 ms
23,880 KB
testcase_38 AC 68 ms
23,844 KB
testcase_39 AC 68 ms
24,288 KB
testcase_40 AC 67 ms
23,652 KB
testcase_41 AC 68 ms
23,592 KB
testcase_42 AC 67 ms
23,472 KB
testcase_43 AC 68 ms
23,688 KB
testcase_44 AC 68 ms
23,724 KB
testcase_45 AC 66 ms
23,688 KB
testcase_46 AC 67 ms
23,388 KB
testcase_47 AC 67 ms
24,036 KB
testcase_48 AC 66 ms
23,472 KB
testcase_49 AC 67 ms
24,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rep(i,a,n) for(int i=(a);i<=(n);++i)
#define dep(i,a,n) for(int i=(a);i>=(n);--i)
#define eps 1e-8
#define pi 3.1415926535897
#define sqr(x) ((x)*(x))
#define SZ(x) ((int)(x).size())
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define POSIN(x,y) (1<=(x)&&(x)<=m&&1<=(y)&&(y)<=n)
#define ALL(x) (x).begin(),(x).end()
#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#ifdef LOCAL
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
#else
#define debug(...) 
#define dbg(x) 
#endif
template<typename T> bool MAX(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool MIN(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
typedef long long ll;
typedef double lf;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<lf,lf> pff;
typedef complex<double> CD;
typedef vector<int> VI;
typedef vector<ll> VL;
const int inf=0x3f3f3f3f;
const int mo=1000000007;
inline void gn(long long&x){
	int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
	while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
template<class T1,class T2>inline void gn(T1&r,T2&s){gn(r),gn(s);}
template<class T1,class T2,class T3>inline void gn(T1&r,T2&s,T3&t){gn(r),gn(s),gn(t);}
template<class T1,class T2,class T3,class T4>inline void gn(T1&r,T2&s,T3&t,T4&u){gn(r),gn(s),gn(t),gn(u);}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
const int DX[]={1,0,-1,0},DY[]={0,1,0,-1};
ll powmod(ll a,ll b) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll powmod(ll a,ll b,ll mo) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//*******************************************

const int N=111111,M=111111;
int l,m,n,t,C;
pii pos(int x){
	if(x==1)return mp(0,0);
	if(x%2==0)return pos(x/2)+mp(1,0);
	return pos(x/5)+mp(0,1);
}
ll x,y;
int ok=0;
void out(ll x){
	if(x>1000000000)::x=x=1000000000;
	printf("%lld\n",x);fflush(stdout);if(x==y){ok=1;return;}scanf("%lld",&y);if(x==y)ok=1;
}
int main(){
#ifdef LOCAL
	// freopen("D.in","r",stdin);//freopen("D.out","w",stdout);
#endif
	scanf("%lld%lld",&x,&y);
	int st=0;
	rep(_,1,36){
		pii px=pos(x),py=pos(y);
		if(st==0){
			if(x==1000000000/4){st=1;continue;}
			if(px.X<7)out(x*=2);else if(px.X>7)out(x/=2);else out(x*=5);
			if(x==1000000000/4){st=1;continue;}
		}else if(st==1){
			if(abs(px.X+px.Y-py.X-py.Y)%2==0){
				out(x*=5);
			}else{
				out(x*=2);
				out(x*=2);++_;
			}
			st=2;
		}else{
			if(px.X<py.X&&abs(px.X-py.X)>abs(px.Y-py.Y))out(x*=2);
			else if(px.X>py.X&&abs(px.X-py.X)>abs(px.Y-py.Y))out(x/=2);
			else if(px.Y<py.Y&&abs(px.X-py.X)<abs(px.Y-py.Y))out(x*=5);
			else if(px.Y>py.Y&&abs(px.X-py.X)<abs(px.Y-py.Y))out(x/=5);
			else assert(0);
		}
		if(ok)break;
	}


	return 0;
}
0