結果

問題 No.2753 鳩の巣原理
ユーザー ttkkggwwttkkggww
提出日時 2024-05-14 14:02:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 4,643 ms
コンパイル使用メモリ 261,772 KB
実行使用メモリ 25,580 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-14 14:02:41
合計ジャッジ時間 8,135 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,580 KB
testcase_01 AC 23 ms
24,836 KB
testcase_02 AC 23 ms
24,964 KB
testcase_03 AC 23 ms
25,220 KB
testcase_04 AC 23 ms
24,964 KB
testcase_05 AC 23 ms
25,208 KB
testcase_06 AC 23 ms
24,836 KB
testcase_07 AC 23 ms
24,820 KB
testcase_08 AC 23 ms
25,220 KB
testcase_09 AC 22 ms
25,196 KB
testcase_10 AC 23 ms
25,196 KB
testcase_11 WA -
testcase_12 AC 22 ms
24,940 KB
testcase_13 WA -
testcase_14 AC 23 ms
24,556 KB
testcase_15 AC 23 ms
24,812 KB
testcase_16 WA -
testcase_17 AC 22 ms
24,940 KB
testcase_18 AC 23 ms
25,324 KB
testcase_19 AC 22 ms
25,196 KB
testcase_20 WA -
testcase_21 AC 25 ms
24,940 KB
testcase_22 AC 23 ms
24,940 KB
testcase_23 AC 22 ms
24,812 KB
testcase_24 AC 25 ms
24,812 KB
testcase_25 AC 22 ms
24,812 KB
testcase_26 AC 23 ms
25,452 KB
testcase_27 AC 23 ms
24,812 KB
testcase_28 AC 24 ms
25,196 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
int N;

void solve(){
	ll ok = 1,ng = N;
	for(int _ = 0;_<10;_++){
		ll mid = (ok+ng)/2;
		ll in;
		cout<< "? " << mid << endl;
		cout<< flush;
		cin >> in;
		if(in == mid) {
			ok = mid;
		}
		else{
			ng = mid;
		}
	}
	cout<<"Yes "<<ok <<' '<<ng<<endl;
	cout<< flush;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> N;
	solve();
}
0