Submission #305283

# Submission time Handle Problem Language Result Execution time Memory
305283 2020-09-22T21:28:02 Z oleksg Mobile (BOI12_mobile) C++11
50 / 100
1000 ms 25380 KB
#include <fstream>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include<bits/stdc++.h>
#include <vector>
using namespace std;

double n, l;
vector<pair<double, double>> points;

bool ok(double cur){
    double curmaxx = 0;
    for (long long x = 0; x < points.size(); x++){
        double curx = points[x].first;
        double 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);
                }
            }
        }
    }
    return curmaxx >= l;
}
int main(){
    double one, two;
    cin >> n >> l;
    for (int x = 0; x < n; x++){
        cin >> one >> two;
        points.push_back(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 + 0.0005;
        }
    }
    printf("%.15g", ma);
}

Compilation message

mobile.cpp: In function 'bool ok(double)':
mobile.cpp:15:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (long long x = 0; x < points.size(); x++){
      |                           ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 512 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 6 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 512 KB Output is correct
2 Correct 12 ms 512 KB Output is correct
3 Correct 8 ms 512 KB Output is correct
4 Correct 10 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 512 KB Output is correct
2 Correct 11 ms 512 KB Output is correct
3 Correct 8 ms 512 KB Output is correct
4 Correct 10 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 512 KB Output is correct
2 Correct 11 ms 640 KB Output is correct
3 Correct 8 ms 512 KB Output is correct
4 Correct 11 ms 640 KB Output is correct
5 Correct 9 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 2464 KB Output is correct
2 Correct 159 ms 3688 KB Output is correct
3 Correct 97 ms 2160 KB Output is correct
4 Correct 155 ms 3688 KB Output is correct
5 Correct 74 ms 1904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 130 ms 2540 KB Output is correct
2 Correct 126 ms 2536 KB Output is correct
3 Correct 148 ms 2540 KB Output is correct
4 Correct 161 ms 2536 KB Output is correct
5 Correct 189 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 2540 KB Output is correct
2 Correct 171 ms 2540 KB Output is correct
3 Correct 157 ms 2540 KB Output is correct
4 Correct 231 ms 2536 KB Output is correct
5 Correct 152 ms 2572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 219 ms 2540 KB Output is correct
2 Correct 210 ms 2540 KB Output is correct
3 Correct 173 ms 2544 KB Output is correct
4 Correct 235 ms 2540 KB Output is correct
5 Correct 182 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 214 ms 2540 KB Output is correct
2 Correct 206 ms 2536 KB Output is correct
3 Correct 173 ms 2540 KB Output is correct
4 Correct 234 ms 2540 KB Output is correct
5 Correct 184 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 820 ms 8820 KB Output is correct
2 Execution timed out 1082 ms 15952 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 8796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 983 ms 16856 KB Output is correct
2 Execution timed out 1090 ms 25380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 17104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 16976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 17124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 16936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 16904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 17140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 17132 KB Time limit exceeded
2 Halted 0 ms 0 KB -