Submission #305312

# Submission time Handle Problem Language Result Execution time Memory
305312 2020-09-22T23:16:22 Z oleksg Mobile (BOI12_mobile) C++14
60 / 100
1000 ms 16872 KB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
using namespace std;

long long n, l;
pair<int, int> points[1000000];

bool ok(double cur){
    double curmaxx = 0;
    for (long long x = 0; x < n; ++x){
        long long curx = points[x].first;
        long long cury = abs(points[x].second);
        if (cur >= cury){
            double xintervals = sqrt(cur * cur - cury * cury);
            double minx = curx - xintervals;
            double maxx = curx + xintervals;
            if (minx <= l && maxx >= 0 && cur >= cury){
                if (minx <= curmaxx){
                    curmaxx = max(curmaxx, maxx);
                    if ((curmaxx) >= l){
                        return true;
                    }
                }
            }
        }
    }
    return curmaxx >= l;
}
int main(){
    long long one, two;
    cin >> n >> l;
    for (int x = 0; x < n; ++x){
        cin >> one >> two;
        points[x] = make_pair(one, two);
    }
    double mi = 0.0;
    double ma = 10000000000;
    //cout << ok(658);
    while(ma > mi + 0.0005){
        double cur = (mi + ma) / 2.0;
        if (ok(cur)){
            ma = cur;
        }
        else{
            mi = cur;
        }
    }
    printf("%.15g", ma);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 888 KB Output is correct
2 Correct 123 ms 1016 KB Output is correct
3 Correct 65 ms 760 KB Output is correct
4 Correct 110 ms 888 KB Output is correct
5 Correct 46 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 888 KB Output is correct
2 Correct 86 ms 920 KB Output is correct
3 Correct 101 ms 888 KB Output is correct
4 Correct 115 ms 888 KB Output is correct
5 Correct 135 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 1144 KB Output is correct
2 Correct 118 ms 1020 KB Output is correct
3 Correct 101 ms 1016 KB Output is correct
4 Correct 175 ms 1144 KB Output is correct
5 Correct 96 ms 1120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 155 ms 1144 KB Output is correct
2 Correct 143 ms 1104 KB Output is correct
3 Correct 109 ms 1140 KB Output is correct
4 Correct 176 ms 1272 KB Output is correct
5 Correct 124 ms 1156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 1144 KB Output is correct
2 Correct 143 ms 1192 KB Output is correct
3 Correct 113 ms 1144 KB Output is correct
4 Correct 174 ms 1144 KB Output is correct
5 Correct 124 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 622 ms 4336 KB Output is correct
2 Correct 770 ms 4492 KB Output is correct
3 Correct 727 ms 11640 KB Output is correct
4 Correct 874 ms 13944 KB Output is correct
5 Correct 666 ms 11036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 839 ms 4296 KB Output is correct
2 Correct 755 ms 10848 KB Output is correct
3 Correct 682 ms 9956 KB Output is correct
4 Correct 898 ms 13540 KB Output is correct
5 Correct 714 ms 11544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 760 ms 5072 KB Output is correct
2 Correct 942 ms 5048 KB Output is correct
3 Correct 928 ms 13840 KB Output is correct
4 Execution timed out 1082 ms 16872 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1002 ms 5016 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 861 ms 5856 KB Output is correct
2 Execution timed out 1085 ms 6008 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 5808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 6580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 6008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 8116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 5156 KB Time limit exceeded
2 Halted 0 ms 0 KB -