結果
問題 |
No.2753 鳩の巣原理
|
ユーザー |
|
提出日時 | 2024-05-10 23:14:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 195,868 KB |
最終ジャッジ日時 | 2025-02-21 13:15:35 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#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; }