# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
687179 | 2023-01-26T07:18:54 Z | nikhil_kumart21 | Mobile (BOI12_mobile) | C++17 | 1000 ms | 131072 KB |
#include <bits/stdc++.h> using namespace std; typedef long double ll; #define endl "\n"; void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } ll fun(vector<vector<ll>>&v,ll mid,ll L){ vector<vector<ll>>a; // cout<<mid<<endl; for(auto it:v){ if(mid<it[1])continue; ll l=it[0]-sqrtl(mid*mid-it[1]*it[1]),r=it[0]+sqrtl(mid*mid-it[1]*it[1]); if(l<=L&&r>=0) a.push_back({l,r}); // cout<<l<<" "<<r<<endl; } if(a.empty())return 1; // cout<<endl; // if() if(a[0][0]>0)return 1; ll num=a[0][1]; for(int i=1;i<a.size();++i){ auto it=a[i]; if(it[0]>num)return 1; num=max(num,it[1]); } if(num<L)return 1; return 0; } bool comp(vector<ll>&a,vector<ll>&b){ ll o=(-1)*1e9; return ((o-a[0])*(o-a[0])+(o-a[1])*(o-a[1]))<((o-b[0])*(o-b[0])+(o-b[1])*(o-b[1])); } int main() { // setIO("angry"); ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); ll n,L; cin>>n>>L; vector<vector<ll>>v; for(int i=0;i<n;++i){ ll l,r; cin>>l>>r; v.push_back({l,r}); } sort(v.begin(),v.end(),comp); ll l=0,r=2e9,mid,ans=0; while(l<=r){ mid=l+(r-l)/2; if(fun(v,mid,L)){ l=mid+1e-4; ans=mid; } else{ r=mid-1e-4; } } cout<<fixed<<setprecision(3)<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 740 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1084 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 1080 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 1104 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 310 ms | 11928 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 379 ms | 12280 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 624 ms | 13420 KB | Output is correct |
2 | Incorrect | 839 ms | 12656 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 918 ms | 14372 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 587 ms | 14400 KB | Output is correct |
2 | Incorrect | 953 ms | 14364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 70748 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 70772 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 93532 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 93536 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 105016 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 105128 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1100 ms | 113116 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1098 ms | 113012 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 692 ms | 131072 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1038 ms | 131072 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |