結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-09-30 00:50:50 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,164 bytes |
| コンパイル時間 | 1,056 ms |
| コンパイル使用メモリ | 110,768 KB |
| 実行使用メモリ | 40,148 KB |
| 最終ジャッジ日時 | 2024-09-30 00:50:58 |
| 合計ジャッジ時間 | 7,732 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 11 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
#include<map>
map<pair<ll,ll>,ll> memo;
ll ask(ll x,ll y){
if(memo.find({x,y})!=memo.end()) return memo[{x,y}];
// cout<<x<<" "<<y<<endl;
ll d;
cin>>d;
if(d==0){
exit(0);
}
return memo[{x,y}] = d;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll left = 0;
ll right = 100000;
while(right-left>2){
ll m1 = (left+left+right) / 3;
ll m2 = (right+right+left) / 3;
ll d1 = ask(m1,0);
ll d2 = ask(m2,0);
if(d1<=d2) right = m2;
else left = m1;
}
ll use;
ll mn = 1e9;
for(ll x = left;x<=right;x++){
ll d = ask(x,0);
if(d<mn){
mn = d;
use = x;
}
}
ll x = mn;
left = 0;
right = 100000;
while(right-left>2){
ll m1 = (left+left+right) / 3;
ll m2 = (right+right+left) / 3;
ll d1 = ask(x,m1);
ll d2 = ask(x,m2);
if(d1<=d2) right = m2;
else left = m1;
}
for(ll x = left;x<=right;x++){
ll d = ask(x,0);
}
}
momoyuu