Submission #520825

# Submission time Handle Problem Language Result Execution time Memory
520825 2022-01-31T05:48:38 Z jpark Mobile (BOI12_mobile) C++14
4 / 100
1000 ms 41204 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-5){
        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 << l;
}

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 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 608 KB Output is correct
2 Incorrect 10 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 161 ms 5116 KB Output is correct
2 Incorrect 265 ms 5096 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 270 ms 4960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 211 ms 5308 KB Output is correct
2 Incorrect 297 ms 5196 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 307 ms 5640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 253 ms 5636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 21588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 21244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 31900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 31828 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 34192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 34128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 36516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 36576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 41152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 41204 KB Time limit exceeded
2 Halted 0 ms 0 KB -