Submission #520821

# Submission time Handle Problem Language Result Execution time Memory
520821 2022-01-31T05:35:28 Z jpark Mobile (BOI12_mobile) C++14
4 / 100
1000 ms 56916 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#define pii pair<int,int>
#define f first
#define s second
using namespace std;

int main(){
    int n,le; cin >> n >> le;
    vector<pii> t;
    int a,b;
    for(int x=0; x<n; ++x){
        cin >> a >> b;
        t.push_back({a,b});
    }
    double l = 0;
    double r = 1e10;
    double mid;
    while(r-l>1e-4){
        vector<pair<double,double>> range;
        mid = l+(r-l)/2;
        for(int x=0; x<n; ++x){
            if(mid<t[x].s){
                continue;
            }
            double mi = t[x].f-sqrt(mid*mid-t[x].s*t[x].s);
            double ma = t[x].f+sqrt(mid*mid-t[x].s*t[x].s);
            range.push_back({mi,ma});
        }
        sort(range.begin(),range.end());
        double maxc = 0;
        bool p = true;
        for(int x=0; x<range.size(); ++x){
            if(range[x].s<0){
                continue;
            }
            if(range[x].f>maxc){
                p = false;
                break;
            }
            maxc = max(maxc,range[x].s);
        }
        if(p&&maxc>=le){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    cout << mid;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int x=0; x<range.size(); ++x){
      |                      ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 616 KB Output is correct
2 Incorrect 14 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 145 ms 4944 KB Output is correct
2 Incorrect 270 ms 5324 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 269 ms 4968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 218 ms 5152 KB Output is correct
2 Incorrect 321 ms 5464 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 331 ms 6304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 300 ms 6268 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 24568 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 28580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1004 ms 36144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1031 ms 40840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 39420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 44884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 42544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1032 ms 48884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 48952 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 56916 KB Time limit exceeded
2 Halted 0 ms 0 KB -