Submission #916286

#TimeUsernameProblemLanguageResultExecution timeMemory
916286asdasdqwerMobile (BOI12_mobile)C++14
8 / 100
1058 ms48304 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t #define pii array<int,2> signed main() { ios::sync_with_stdio(false); cin.tie(0); int n,t;cin>>n>>t; vector<pii> v(n); for (auto &x:v)cin>>x[0]>>x[1]; double l = 1; double r = 1e9; vector<bool> rem(n, false); while (abs(l-r) > 0.0001) { double m = (l+r)/2.0; int i=0; vector<array<double,2>> start; for (auto &x:v) { if ((double)abs(x[1]) >= m) { rem[i]=true; } else { double aa=abs(x[1]); double dis=sqrt(m*m-aa*aa); array<double,2> pos1 = {x[0]-dis,x[0]+dis}; if ((pos1[0] < 0.0 && pos1[1] < 0.0) || (pos1[0] > (double)t && pos1[1] > (double)t)) { rem[i]=true; } else { pos1[0]=max(pos1[0], 0.0); pos1[1]=min(pos1[1], (double)t); start.push_back(pos1); } } i++; } start.push_back({0.0, 0.0}); start.push_back({(double)t,(double)t}); sort(start.begin(),start.end()); array<double,2> pos={0.0, 0.0}; bool possible=true; for (auto &x:start) { if (x[0] <= pos[1]) { pos[1]=max(pos[1], x[1]); } else { possible=false; break; } } if (possible) { r=m; int cnt=0; int pt=0; for (int i=0;i<n;i++) { if (rem[i]) { cnt++; } else if (cnt != 0) { swap(v[i], v[pt]); } if (!rem[i]) { pt++; } } n -= cnt; while (v.size() != n){ v.pop_back(); } for (int i=0;i<n;i++) { rem[i]=false; } } else { l=m; for (int i=0;i<n;i++) { rem[i]=false; } } } cout<<r<<"\n"; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:85:29: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<long int, 2> >::size_type' {aka 'long unsigned int'} and 'int64_t' {aka 'long int'} [-Wsign-compare]
   85 |             while (v.size() != n){
      |                    ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...