Submission #470013

# Submission time Handle Problem Language Result Execution time Memory
470013 2021-09-02T15:12:47 Z Shogun3103 Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 16104 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;

    ld l = 1, r = 1.5e9;
    while(r - l > 1e-3) {
        ld m = (l + r) * 0.5, cur = 0;
        FOR(i, 1, n) {
            ld delta = sqrt(m * m - a[i].Y * a[i].Y);
            ld x = a[i].X - delta, y = a[i].X + delta;
            if(x <= cur) cur = max(cur, y);
        }
        if(cur >= len) r = m - 0.0001;
        else l = m + 0.0001;   
    }
    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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# 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 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 9 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 5 ms 316 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Correct 9 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Correct 12 ms 460 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 97 ms 1360 KB Output is correct
2 Correct 77 ms 1392 KB Output is correct
3 Correct 59 ms 1132 KB Output is correct
4 Correct 142 ms 1456 KB Output is correct
5 Correct 62 ms 956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 109 ms 1400 KB Output is correct
2 Correct 120 ms 1384 KB Output is correct
3 Correct 133 ms 1544 KB Output is correct
4 Correct 143 ms 1416 KB Output is correct
5 Correct 170 ms 1604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1656 KB Output is correct
2 Correct 101 ms 1476 KB Output is correct
3 Correct 101 ms 1600 KB Output is correct
4 Correct 215 ms 1804 KB Output is correct
5 Correct 145 ms 1604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 1732 KB Output is correct
2 Correct 98 ms 1800 KB Output is correct
3 Correct 105 ms 1888 KB Output is correct
4 Correct 215 ms 1792 KB Output is correct
5 Correct 166 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 1860 KB Output is correct
2 Correct 95 ms 1772 KB Output is correct
3 Correct 102 ms 1840 KB Output is correct
4 Correct 213 ms 1840 KB Output is correct
5 Correct 163 ms 1732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 419 ms 8004 KB Output is correct
2 Correct 527 ms 8216 KB Output is correct
3 Correct 488 ms 8004 KB Output is correct
4 Execution timed out 1093 ms 8132 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 512 ms 8024 KB Output is correct
2 Correct 717 ms 8004 KB Output is correct
3 Correct 544 ms 8004 KB Output is correct
4 Execution timed out 1051 ms 8084 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 505 ms 9568 KB Output is correct
2 Correct 621 ms 9668 KB Output is correct
3 Correct 612 ms 9752 KB Output is correct
4 Execution timed out 1083 ms 9668 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 634 ms 9668 KB Output is correct
2 Correct 854 ms 9664 KB Output is correct
3 Correct 646 ms 9676 KB Output is correct
4 Execution timed out 1097 ms 9572 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 585 ms 11316 KB Output is correct
2 Correct 903 ms 11236 KB Output is correct
3 Correct 690 ms 11212 KB Output is correct
4 Execution timed out 1076 ms 11236 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 723 ms 11200 KB Output is correct
2 Execution timed out 1012 ms 11232 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 669 ms 12840 KB Output is correct
2 Correct 806 ms 12752 KB Output is correct
3 Correct 776 ms 12824 KB Output is correct
4 Execution timed out 1089 ms 12696 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 831 ms 12800 KB Output is correct
2 Execution timed out 1085 ms 12804 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 883 ms 15840 KB Output is correct
2 Execution timed out 1026 ms 16000 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 16104 KB Time limit exceeded
2 Halted 0 ms 0 KB -