# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988347 | hegoplay | Balloons (CEOI11_bal) | C++14 | 108 ms | 8720 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
-
+=
@@@@@%
+@@@@@@+
%@@@@@#%
@@@@@@@@=:
+****************** =@@@@@@@@@% =***********#*******+
%@@@@@@@@@@@@@@@@@@@@= @@@@@@@@@@% #@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@+ +@@#@@@@@@@@% @@@@@@@@@@@@@@@@@@@@@@@=
+@@@@% *@@%@@@@@@@@@= %@@@%
@@@@@# *@@@@@@@@@@@@# #@@@@@
%@@@@% +@@@@@@@@@@@@% @@@@@@@@@@@@@@@@@@@@%
#@@@@@ =#+@@@@@@@@#@% =@@@@@@@@@@@@@@@@@@@@*
+@@@@@+ #@@@@@@% =@@@@@=
=@@@@@* #@@@@@@# @@@@@*
#@@@@@@@@@@@@@@@@@@@@@ +@@@@@@# *@@@@@@@@@@@@@@@@@@@@@@#
+@@@@@@@@@@@@@@@@@@@@= %@@@@@% +@@@@@@@@@@@@@@@@@@@@@@+
+*#************##* =@@@@@#+ ###**##**#*******##*+
=@@@@@@%
+** =+=
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |