# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104320 | 2024-10-23T12:51:18 Z | YudoTLE | Balloons (CEOI11_bal) | C++17 | 114 ms | 10132 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = double; using ldb = long double; using vi = vector<int>; using vll = vector<ll>; using vdb = vector<db>; using vldb = vector<ldb>; using vb = vector<bool>; using pi = pair<int, int>; using pll = pair<ll, ll>; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() void solve() { int n; cin >> n; vll x(n); vldb r(n); for (int i = 0; i < n; i++) cin >> x[i] >> r[i]; auto calc_r = [&](int src, int i) { ll dx = abs(x[src] - x[i]); return dx * dx / (r[i] * 4); }; auto cmp = [&](int src, int i1, int i2) { return calc_r(src, i1) <= calc_r(src, i2); }; vi stk{0}; for (int i = 1; i < n; i++) { while (!stk.empty()) { int j = stk.back(); ldb nr = calc_r(i, j); r[i] = min(r[i], nr); if (r[i] >= r[j]) stk.pop_back(); else break; } stk.pb(i); } cout << fixed << setprecision(3); for (int i = 0; i < n; i++) cout << r[i] << " \n"[i==n-1]; } int main() { ios_base::sync_with_stdio(false), cin.tie(0); int t = 1; // cin >> t; while (t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 336 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1104 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 2120 KB | 50000 numbers |
2 | Correct | 30 ms | 2912 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 66 ms | 4936 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 74 ms | 5860 KB | 115362 numbers |
2 | Correct | 69 ms | 6216 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 98 ms | 5448 KB | 154271 numbers |
2 | Correct | 114 ms | 10132 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 109 ms | 6728 KB | 200000 numbers |
2 | Correct | 101 ms | 10056 KB | 199945 numbers |