답안 #305284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
305284 2020-09-22T21:29:48 Z oleksg Mobile (BOI12_mobile) C++11
19 / 100
1000 ms 17136 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 > 0.001){
        double cur = (mi + ma) / 2.0;
        if (ok(cur)){
            ma = cur;
        }
        else{
            mi = cur + 0.001;
        }
    }
    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++){
      |                           ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 512 KB Output is correct
2 Incorrect 9 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 512 KB Output is correct
2 Incorrect 10 ms 512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 2536 KB Output is correct
2 Correct 144 ms 2540 KB Output is correct
3 Correct 87 ms 1648 KB Output is correct
4 Correct 153 ms 2540 KB Output is correct
5 Correct 65 ms 1520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 2536 KB Output is correct
2 Correct 116 ms 2540 KB Output is correct
3 Correct 140 ms 2744 KB Output is correct
4 Correct 159 ms 2536 KB Output is correct
5 Correct 183 ms 2536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 124 ms 2668 KB Output is correct
2 Correct 156 ms 2540 KB Output is correct
3 Correct 136 ms 2540 KB Output is correct
4 Correct 228 ms 2564 KB Output is correct
5 Incorrect 139 ms 2544 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 198 ms 2540 KB Output is correct
2 Correct 186 ms 2676 KB Output is correct
3 Correct 152 ms 2664 KB Output is correct
4 Correct 236 ms 2540 KB Output is correct
5 Correct 168 ms 2568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 2568 KB Output is correct
2 Correct 185 ms 2540 KB Output is correct
3 Correct 152 ms 2536 KB Output is correct
4 Correct 226 ms 2468 KB Output is correct
5 Incorrect 170 ms 2540 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 776 ms 8812 KB Output is correct
2 Execution timed out 1006 ms 8800 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1026 ms 8776 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 941 ms 16976 KB Output is correct
2 Execution timed out 1055 ms 16988 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1049 ms 17004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 16996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 16852 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1093 ms 17136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1086 ms 17072 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 16968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 17020 KB Time limit exceeded
2 Halted 0 ms 0 KB -