結果

問題 No.2753 鳩の巣原理
ユーザー Nzt3Nzt3
提出日時 2024-05-10 23:14:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 203,996 KB
実行使用メモリ 25,424 KB
平均クエリ数 11.00
最終ジャッジ日時 2024-05-10 23:15:00
合計ジャッジ時間 4,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int MOD=998244353;

vector<int>X(1,0);

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;

  mt19937 rd(3);
  for(int i=1;i<=N;i++){
    X.push_back(0);
    if(i!=2)X[i]=1;
    X[i]+=X[i-1];
  }
  array<int,2>l={0,0},r={N,N-1};
  for(int i=0;i<10;i++){
    int m=(l[0]+r[0])/2;
    cout<<"? "<<m<<endl;
    int t;
    cin>>t;
    if(m-l[0]>t-l[1]){
      r={m,t};
    }else{
      l={m,t};
    }
  }
  cout<<"Yes "<<l[0]<<' '<<r[0]<<endl;
}
0