結果

問題 No.253 ロウソクの長さ
ユーザー heno239heno239
提出日時 2020-08-20 18:58:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,738 bytes
コンパイル時間 968 ms
コンパイル使用メモリ 108,972 KB
実行使用メモリ 24,492 KB
平均クエリ数 33.06
最終ジャッジ日時 2023-09-24 05:46:14
合計ジャッジ時間 6,635 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 22 ms
24,048 KB
testcase_02 AC 23 ms
24,252 KB
testcase_03 AC 21 ms
23,628 KB
testcase_04 AC 23 ms
23,592 KB
testcase_05 AC 22 ms
23,340 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 20 ms
23,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 21 ms
23,532 KB
testcase_15 AC 23 ms
23,532 KB
testcase_16 AC 23 ms
24,348 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 23 ms
23,652 KB
testcase_20 WA -
testcase_21 AC 23 ms
23,640 KB
testcase_22 AC 21 ms
24,048 KB
testcase_23 WA -
testcase_24 AC 22 ms
23,604 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 21 ms
23,604 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

int query(int x) {
	cout << "? " << x << endl;
	int res; cin >> res; return res;
}
void fin(int x) {
	cout << "! " << x << endl;
}
void solve() {
	int res = query(90);
	if (res == 0) {
		fin(90); return;
	}
	else if (res < 0) {
		int tmp = 1;
		while (true) {
			res = query(0);
			if (res == 0) {
				fin(tmp); return;
			}
			tmp++;
		}
	}
	else {
		int tmp = 1;
		int le = 90, ri = 1000000001;
		while (ri - le > 1) {
			int mid = (le + ri) / 2;
			int res = query(mid - tmp); tmp++;
			if (res >= 0)le = mid;
			else ri = mid;
		}
		fin(le + tmp - 1);
	}
}


signed main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}
0