結果

問題 No.2753 鳩の巣原理
ユーザー Spica08Spica08
提出日時 2024-05-10 22:35:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 2,351 ms
コンパイル使用メモリ 202,736 KB
実行使用メモリ 25,580 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-10 22:35:36
合計ジャッジ時間 4,781 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0