Submission #906058

# Submission time Handle Problem Language Result Execution time Memory
906058 2024-01-13T13:00:57 Z Ludissey Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 90524 KB
#include <bits/stdc++.h>
using namespace std;
#define int double
 
double dist(double x1, double y1, double x2, double y2){
    double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
    return dist;
}

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,L; cin >> N >> L;
    vector<pair<double,double>> a(N);
    map<int,int> minabs;
    for (int i = 0; i < N; i++){
        cin >> a[i].first >> a[i].second;
        if(minabs.find(a[i].first)==minabs.end()) {
            minabs[a[i].first]=abs(a[i].second);
        }
        else {
            minabs[a[i].first]=min(minabs[a[i].first],abs(a[i].second));
        }
    }
    double toL=1e10+100;
    double toO=1e10+100;
    double mxDst=0;
    for (int i = 0; i < N; i++)
    {
        toO=min(dist(0,0,a[i].first,minabs[a[i].first]),toO);
        toL=min(dist(L,0,a[i].first,minabs[a[i].first]),toL);
    }
    mxDst=max(toO,toL);
    for (int i = 0; i < N-1; i++)
    {
        double x1=a[i].first,y1=minabs[a[i].first],x2=a[i+1].first,y2=minabs[a[i+1].first];
        if(x1==x2) continue;
        else{
            double x=(((pow(x2,2)+pow(y2,2))-pow(x1,2))-pow(y1,2))/((((double)2*x1)-(double)2*x2));
            if(x>L||x<0) continue;
            mxDst=max(min(dist(x2,y2,x,0),dist(x1,y1,x,0)),mxDst);
        }
    }
    cout << setprecision(4) << fixed << (double)mxDst << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 6636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 2676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 74 ms 7764 KB Output is correct
2 Incorrect 81 ms 6040 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 88 ms 6232 KB Output is correct
2 Incorrect 86 ms 5920 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 9556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 571 ms 43860 KB Output is correct
2 Correct 279 ms 16628 KB Output is correct
3 Correct 271 ms 15996 KB Output is correct
4 Incorrect 596 ms 49072 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 326 ms 16784 KB Output is correct
2 Incorrect 683 ms 45780 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 615 ms 52744 KB Output is correct
2 Correct 325 ms 19684 KB Output is correct
3 Correct 340 ms 18772 KB Output is correct
4 Incorrect 778 ms 59120 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 324 ms 20056 KB Output is correct
2 Incorrect 864 ms 54700 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 804 ms 61268 KB Output is correct
2 Correct 390 ms 22424 KB Output is correct
3 Correct 394 ms 21904 KB Output is correct
4 Incorrect 948 ms 68720 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 393 ms 23124 KB Output is correct
2 Incorrect 791 ms 63652 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 949 ms 70060 KB Output is correct
2 Correct 419 ms 25852 KB Output is correct
3 Correct 413 ms 24916 KB Output is correct
4 Execution timed out 1012 ms 78676 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 465 ms 26436 KB Output is correct
2 Execution timed out 1076 ms 72772 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 87192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 581 ms 32728 KB Output is correct
2 Execution timed out 1014 ms 90524 KB Time limit exceeded
3 Halted 0 ms 0 KB -