結果
問題 | No.2753 鳩の巣原理 |
ユーザー |
|
提出日時 | 2024-05-10 22:35:30 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 2,245 ms |
コンパイル使用メモリ | 202,984 KB |
実行使用メモリ | 25,580 KB |
平均クエリ数 | 11.00 |
最終ジャッジ日時 | 2024-12-20 06:29:04 |
合計ジャッジ時間 | 5,158 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using ull = unsigned long long;using Matrix = vector<vector<ll>>;const int inf = 1000000000;const ll INF = 1000000000000000000;const ll mod = 998244353;const ull mod_hash = (1UL << 61) - 1;const vector<int> dx = {0, 1, 0, -1, 1, 1, -1, -1};const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};int main(){int N;cin>>N;int l = 1;int r = N;int q = 0;while((r - l) > 1){int mid = (l + r) >> 1;cout<<"? "<<mid<<endl;q++;int n;cin>>n;if(mid>n){r = mid;}else{l = mid;}}while(q<10){cout<<"? 1"<<endl;int n;cin>>n;q++;}cout<<"Yes "<<l<<" "<<r<<endl;return 0;}