# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988347 | 2024-05-24T14:22:30 Z | hegoplay | Balloons (CEOI11_bal) | C++14 | 108 ms | 8720 KB |
/* - += @@@@@% +@@@@@@+ %@@@@@#% @@@@@@@@=: +****************** =@@@@@@@@@% =***********#*******+ %@@@@@@@@@@@@@@@@@@@@= @@@@@@@@@@% #@@@@@@@@@@@@@@@@@@@@@@ +@@@@@@@@@@@@@@@@@@@@@+ +@@#@@@@@@@@% @@@@@@@@@@@@@@@@@@@@@@@= +@@@@% *@@%@@@@@@@@@= %@@@% @@@@@# *@@@@@@@@@@@@# #@@@@@ %@@@@% +@@@@@@@@@@@@% @@@@@@@@@@@@@@@@@@@@% #@@@@@ =#+@@@@@@@@#@% =@@@@@@@@@@@@@@@@@@@@* +@@@@@+ #@@@@@@% =@@@@@= =@@@@@* #@@@@@@# @@@@@* #@@@@@@@@@@@@@@@@@@@@@ +@@@@@@# *@@@@@@@@@@@@@@@@@@@@@@# +@@@@@@@@@@@@@@@@@@@@= %@@@@@% +@@@@@@@@@@@@@@@@@@@@@@+ +*#************##* =@@@@@#+ ###**##**#*******##*+ =@@@@@@% +** =+= Michael Jackson peeks "Nothing is hard to understand, you just didn't get it." @author: MahK17 */ #include <bits/stdc++.h> #include <set> #include <vector> #include <algorithm> #include <map> #include <queue> #include <stack> #include <cmath> #include <unordered_map> #include <unordered_set> #include <string> #include <sstream> #include <numeric> #include <cstdio> #include <cstring> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define inf 0x3f3f3f3f3f3f3f3f #define all(x) (x).begin(), (x).end() #define yes cout << "YES\n"; #define no cout << "NO\n"; #define sz(x) (int)(x).size() #define el "\n" typedef long long ll; typedef long double ld; #define int long long using namespace __gnu_pbds; using namespace std; #define indexed_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> void setIO(string name = "") { if (sz(name)) { freopen((name + ".in").c_str(), "r", stdin); // see /general/input-output freopen((name + ".out").c_str(), "w", stdout); } } ld find(ld lb, ld x1, ld x2) { // binary search 4*lb*x = (x1-x2)**2 return (x1 - x2) * (x1 - x2) / (4 * lb); } void solve() { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } stack<pair<ld, ld>> s; for (int i = 0; i < n; i++) { ld curSize = a[i].second; while (!s.empty()) { ld x1 = s.top().first; ld x2 = a[i].first; ld lb = s.top().second; ld x = find(lb, x1, x2); curSize = min(curSize, x); if (curSize >= lb) { s.pop(); } else break; } s.push({a[i].first, curSize}); printf("%.3Lf\n", curSize); } } signed main() { ios ::sync_with_stdio(false); std::cin.tie(nullptr); ll t = 1; // cin >> t; while (t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | 10 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | 2 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | 505 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | 2000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1116 KB | 20000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 2648 KB | 50000 numbers |
2 | Correct | 20 ms | 2392 KB | 49912 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 4240 KB | 100000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 4688 KB | 115362 numbers |
2 | Correct | 48 ms | 5720 KB | 119971 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 5864 KB | 154271 numbers |
2 | Correct | 90 ms | 8720 KB | 200000 numbers |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 108 ms | 6896 KB | 200000 numbers |
2 | Correct | 75 ms | 8560 KB | 199945 numbers |