結果

問題 No.253 ロウソクの長さ
ユーザー kyuridenamidakyuridenamida
提出日時 2015-07-24 23:43:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,936 bytes
コンパイル時間 1,234 ms
コンパイル使用メモリ 145,944 KB
実行使用メモリ 24,528 KB
平均クエリ数 53.83
最終ジャッジ日時 2023-09-23 05:02:00
合計ジャッジ時間 5,421 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,388 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 25 ms
24,300 KB
testcase_07 AC 26 ms
23,424 KB
testcase_08 AC 24 ms
23,628 KB
testcase_09 WA -
testcase_10 AC 26 ms
23,700 KB
testcase_11 AC 26 ms
23,448 KB
testcase_12 AC 27 ms
23,448 KB
testcase_13 AC 26 ms
23,412 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 25 ms
23,664 KB
testcase_17 AC 25 ms
24,024 KB
testcase_18 AC 25 ms
23,652 KB
testcase_19 AC 25 ms
23,532 KB
testcase_20 AC 25 ms
24,024 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 26 ms
23,532 KB
testcase_24 WA -
testcase_25 AC 26 ms
23,592 KB
testcase_26 AC 25 ms
24,024 KB
testcase_27 AC 26 ms
23,640 KB
testcase_28 AC 26 ms
23,652 KB
testcase_29 AC 27 ms
23,388 KB
testcase_30 AC 26 ms
23,628 KB
testcase_31 AC 26 ms
24,048 KB
testcase_32 AC 26 ms
24,324 KB
testcase_33 AC 26 ms
23,556 KB
testcase_34 WA -
testcase_35 AC 26 ms
23,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
	return b ? gcd(b,a%b) : a;
}
long long lcm(long long a,long long b){
	return a / gcd(a,b) * b;
}

long long mul(long long a,long long b,const long long mod){
	return b?(mul(a*2,b/2,mod)+(b&1?a:0))%mod:0;
}

long long bpow(long long a,long long b,const long long mod){
	return (b?bpow(a*a%mod,b/2,mod)*(b&1?a:1):1)%mod;
}

long long inv(long long a,const long long mod){
	return bpow(a,mod-2,mod);
}

// to overflow
/*long long bpow(long long a,long long b,const long long mod){
	return (b?mul(bpow(mul(a,a,mod),b/2,mod),(b&1?a:1),mod):1)%mod;
}*/
class mInt{
public:
	static const long long mod = 1000000007;
	long long v;
	mInt():v(0){}
	mInt(long long v):v((v%mod+mod)%mod){}
};
mInt& operator += (mInt &a,mInt b){ return a = a.v + b.v; }
mInt& operator -= (mInt &a,mInt b){ return a = a.v - b.v; }
mInt& operator *= (mInt &a,mInt b){ return a = a.v * b.v; }
mInt& operator /= (mInt &a,mInt b){ return a = a.v * inv(b.v,mInt::mod); }
mInt operator + (mInt a,mInt b){ return a += b; }
mInt operator - (mInt a,mInt b){ return a -= b; }
mInt operator * (mInt a,mInt b){ return a *= b; }
mInt operator / (mInt a,mInt b){ return a /= b; }
ostream& operator<<(ostream& os, const mInt& x){ return os << x.v; }

double ncr1[4000][4000];
long long ncr2[4000][4000];

long long nHr(int n,int r){
	int a = n + r - 1;
	int b = r-1;
	if( ncr1[a][b] > 1e17 ) return 1e17;
	return ncr2[a][b];
}


int Q(int n){
	cout << "? " << n << endl;
	string s1;
	int ans;
	cin >> ans;
	return ans;
}

int D(int a){
	cout << "! " << a << endl;
	exit(0);
}

int main(){
	int T = 0;
	T++;
	if( Q(100) == -1 ){
		for(int i = 0 ; i < 100 ; i++ ){
			int t = Q(i);
			if( t == 0 ) D(i+T);
			T++;
		}
	}else{
		int l = 0 , r = 1e9;
		while( l != r ){
			int m = (l+r+1) / 2;
			if( Q(m-T) == -1 ){ // Y < (?)
				r = m-1;
			}else{
				l = m;
			}
			T++;
		}
		D(l);
		
	}
	
	
}
0