Submission #813505

# Submission time Handle Problem Language Result Execution time Memory
813505 2023-08-07T19:10:06 Z serifefedartar Balloons (CEOI11_bal) C++17
50 / 100
2000 ms 9256 KB
#include <bits/stdc++.h>
using namespace std;
 
#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define f first
#define s second
#define MOD 1000000007
#define LOGN 12
#define MAXN 3000000
typedef long double ld;

ld find(ld r1, ll x1, ll x2) {
    ll d_sq = (x2 - x1) * (x2 - x1);
    ld ans = (d_sq * 1.0) / (4 * r1);
    return ans;
}

int main() {
    fast
    int n;
    cin >> n;

    vector<pair<ll,ll>> bal(n+1);
    vector<ld> ans(n+1);
    for (int i = 1; i <= n; i++)
        cin >> bal[i].f >> bal[i].s;

    for (int i = 1; i <= n; i++) {
        ans[i] = (ld)bal[i].s;
        for (int j = 1; j < i; j++)
            ans[i] = min(ans[i], find(ans[j], bal[j].f, bal[i].f));
    }

    cout << setprecision(10) << fixed;
    for (int i = 1; i <= n; i++)
        cout << ans[i] << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 316 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 14 ms 328 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 968 ms 1444 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 2516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 4820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 5588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 7316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 9256 KB Time limit exceeded
2 Halted 0 ms 0 KB -