Submission #520823

# Submission time Handle Problem Language Result Execution time Memory
520823 2022-01-31T05:43:22 Z jpark Mobile (BOI12_mobile) C++14
4 / 100
1000 ms 40400 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 << 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 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 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 608 KB Output is correct
2 Incorrect 16 ms 624 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 218 ms 4492 KB Output is correct
2 Incorrect 302 ms 4504 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 289 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 233 ms 4700 KB Output is correct
2 Incorrect 329 ms 4696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 320 ms 4984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 303 ms 5168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 20648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 20640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 31156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 31048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 33552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 33364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 35916 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 35764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 40400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 40332 KB Time limit exceeded
2 Halted 0 ms 0 KB -