Submission #470017

# Submission time Handle Problem Language Result Execution time Memory
470017 2021-09-02T15:19:57 Z Shogun3103 Mobile (BOI12_mobile) C++17
85 / 100
1000 ms 16176 KB
#include <bits/stdc++.h>
 
using namespace std;

void setIO(string fileName = ""){
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);        
    if(fileName.length()){
        freopen((fileName+".in").c_str(), "r", stdin);
        freopen((fileName+".out").c_str(), "w", stdout);
    }
}

#define ll long long
#define ld long double
#define FOR(i,a,b) for(__typeof(b) i=a; i<=b; i++)
#define FOD(i,a,b) for(__typeof(b) i=b; i>=a; i--)
#define EACH(u, v) for(auto& u : v)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,ii>
#define ld2 pair<ld, ld>
#define ll2 pair<ll, ll>
#define X first
#define Y second
#define ed "\n"
#define sp " "
const int oo = 1e9 + 7;
const int N = 1e6 + 10;

int n, len;
ll2 a[N];

void solve()
{
    cin >> n >> len;
    FOR(i, 1, n) cin >> a[i].X >> a[i].Y;

    double l = 1, r = 1.5e9;
    while(r - l > 1e-3) {
        double m = (l + r) / 2, cur = 0;
        FOR(i, 1, n) {
            double delta = sqrt(m * m - a[i].Y * a[i].Y);
            double x = a[i].X - delta, y = a[i].X + delta;
            if(x <= cur) cur = max(cur, y);
        }
        if(cur >= len) r = m;
        else l = m;   
    }
    cout << fixed << setprecision(6) << l; 
}   

int main()
{ 
    //setIO("");
    int t; 
    t = 1;
    //cin >> t;
    FOR(i, 1, t) {
        solve();
    }
    return 0;
}

Compilation message

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:8:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         freopen((fileName+".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:9:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         freopen((fileName+".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 8 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 324 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1500 KB Output is correct
2 Correct 67 ms 1580 KB Output is correct
3 Correct 46 ms 1164 KB Output is correct
4 Correct 78 ms 1532 KB Output is correct
5 Correct 38 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 1568 KB Output is correct
2 Correct 62 ms 1476 KB Output is correct
3 Correct 78 ms 1580 KB Output is correct
4 Correct 79 ms 1612 KB Output is correct
5 Correct 96 ms 1756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1732 KB Output is correct
2 Correct 73 ms 1620 KB Output is correct
3 Correct 70 ms 1700 KB Output is correct
4 Correct 117 ms 1988 KB Output is correct
5 Correct 74 ms 1724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 1972 KB Output is correct
2 Correct 93 ms 1868 KB Output is correct
3 Correct 81 ms 1888 KB Output is correct
4 Correct 117 ms 1988 KB Output is correct
5 Correct 94 ms 2052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 1908 KB Output is correct
2 Correct 88 ms 1860 KB Output is correct
3 Correct 79 ms 1988 KB Output is correct
4 Correct 118 ms 2104 KB Output is correct
5 Correct 91 ms 2008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 362 ms 8220 KB Output is correct
2 Correct 461 ms 8296 KB Output is correct
3 Correct 453 ms 8260 KB Output is correct
4 Correct 574 ms 8232 KB Output is correct
5 Correct 473 ms 8316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 482 ms 8260 KB Output is correct
2 Correct 515 ms 8424 KB Output is correct
3 Correct 408 ms 8332 KB Output is correct
4 Correct 559 ms 8260 KB Output is correct
5 Correct 496 ms 8224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 440 ms 9796 KB Output is correct
2 Correct 553 ms 9820 KB Output is correct
3 Correct 544 ms 9780 KB Output is correct
4 Correct 696 ms 10000 KB Output is correct
5 Correct 575 ms 9800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 573 ms 9792 KB Output is correct
2 Correct 627 ms 9808 KB Output is correct
3 Correct 484 ms 9924 KB Output is correct
4 Correct 721 ms 9852 KB Output is correct
5 Correct 701 ms 9796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 502 ms 11300 KB Output is correct
2 Correct 652 ms 11332 KB Output is correct
3 Correct 635 ms 11460 KB Output is correct
4 Correct 835 ms 11448 KB Output is correct
5 Correct 656 ms 11460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 680 ms 11412 KB Output is correct
2 Correct 700 ms 11460 KB Output is correct
3 Correct 578 ms 11440 KB Output is correct
4 Correct 803 ms 11460 KB Output is correct
5 Correct 674 ms 11428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 577 ms 12964 KB Output is correct
2 Correct 734 ms 12912 KB Output is correct
3 Correct 708 ms 12980 KB Output is correct
4 Correct 934 ms 12912 KB Output is correct
5 Correct 781 ms 12936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 12932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 731 ms 16176 KB Output is correct
2 Correct 927 ms 16100 KB Output is correct
3 Correct 897 ms 16140 KB Output is correct
4 Execution timed out 1080 ms 16156 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1006 ms 16092 KB Time limit exceeded
2 Halted 0 ms 0 KB -