結果
| 問題 |
No.2753 鳩の巣原理
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2024-05-10 22:04:10 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 954 bytes |
| コンパイル時間 | 3,573 ms |
| コンパイル使用メモリ | 244,856 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 11.00 |
| 最終ジャッジ日時 | 2024-12-20 05:42:08 |
| 合計ジャッジ時間 | 5,365 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n;
cin >> n;
ll ok=0,ng=n+1;
ll cnt=0;
while(1<abs(ok-ng)){
ll mid=(ok+ng)/2;
cnt++;
cout << "? " << mid << endl;
ll res;
cin >> res;
if(mid<=res) ok=mid;
else ng=mid;
}
while(cnt<10){
cout << "? 1" << endl;
ll res;
cin >> res;
cnt++;
}
cout << "Yes " << ok << ' ' << ng << '\n';
}
FplusFplusF