結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-17 22:25:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 2,950 ms |
| コンパイル使用メモリ | 196,768 KB |
| 最終ジャッジ日時 | 2025-01-09 07:34:02 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
lint query(lint x, lint y){
std::cout<<x<<" "<<y<<std::endl;
lint ans;
std::cin>>ans;
if(!ans)exit(0);
return ans;
}
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint max=100000;
std::vector<lint>ans(2);
for(lint i=0;i<2;i++){
auto cal=[&](lint x){
std::vector<int>a(2);
a.at(i)=x;
return query(a.at(0),a.at(1));
};
lint l=0,r=max+1;
while(1<r-l){
lint c=(l+r)/2;
(cal(c-1)>cal(c)?l:r)=c;
}
ans.at(i)=l;
}
std::cout<<ans.at(0)<<" "<<ans.at(1)<<'\n';
}
ngtkana