結果
| 問題 |
No.2753 鳩の巣原理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 21:56:38 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 695 bytes |
| コンパイル時間 | 2,915 ms |
| コンパイル使用メモリ | 244,292 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 11.00 |
| 最終ジャッジ日時 | 2024-12-20 05:19:09 |
| 合計ジャッジ時間 | 8,104 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 24 |
ソースコード
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
int n;
cin >> n;
auto query = [&](int i)->int{
cout << "? " << i << endl;
int x;
cin >> x;
return x;
};
int l = 1, r = n, lx = 1, rx = n - 1, cnt = 0;
while(r - l >= 2){
++ cnt;
int m = l + r >> 1;
int mx = query(m);
if(mx - lx < m - l){
l = m;
lx = mx;
}
else{
r = m;
rx = mx;
}
}
while(cnt < 10){
query(1);
++ cnt;
}
cout << "Yes " << l << " " << r << "\n";
return 0;
}
/*
*/