結果

問題 No.2753 鳩の巣原理
ユーザー ttkkggww
提出日時 2024-05-14 14:02:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 4,252 ms
コンパイル使用メモリ 250,140 KB
最終ジャッジ日時 2025-02-21 14:02:00
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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