Submission #305304

# Submission time Handle Problem Language Result Execution time Memory
305304 2020-09-22T23:01:35 Z oleksg Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 16924 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);
                    if ((curmaxx) >= l){
                        return true;
                    }
                }
            }
        }
    }
    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){
        double cur = (mi + ma) / 2.0;
        if (ok(cur)){
            ma = cur;
        }
        else{
            mi = cur;
        }
    }
    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 Execution timed out 1063 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 2540 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1070 ms 2580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 2536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 2536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 2536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 8664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 8668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 16924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 8716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 16812 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1028 ms 8724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 16852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 8620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 16840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 9692 KB Time limit exceeded
2 Halted 0 ms 0 KB -