# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
447496 |
2021-07-26T15:09:06 Z |
rieyuw |
Balloons (CEOI11_bal) |
C++17 |
|
211 ms |
12552 KB |
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <unordered_set>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <climits>
#include <queue>
#include <array>
using namespace std;
#define f first
#define s second
const int mxN = 1000;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
/*Problem: */
void solve() {}
void Inflate(stack<pair<int, double>>& stk, int& x, double& r)
{
}
int main()
{
ios::sync_with_stdio(0), cin.tie(0);
//freopen("paintbarn.in", "r", stdin);
//freopen("paintbarn.out", "w", stdout);
//int t = 1; cin >> t; while (t--) solve();
int n; cin >> n;
vector<int> x(n); vector<long double> dia(n);
for (int i = 0; i < n; ++i)
cin >> x[i] >> dia[i];
stack<pair<int, long double>> stk;
for (int i = 0; i < n; ++i)
{
while (!stk.empty())
{
int x1 = stk.top().f;
double r1 = stk.top().s;
//dia[i] = min(dia[i], (x1 - x[i]) / 4.0 * r1 * (x1 - x[i]));
dia[i] = min(dia[i], ((long long)(x1 - x[i]) * (x1 - x[i])) / (long double)(4 * r1));
//cout << "i: " << i << ", x1: " << x1 << ", r1: " << r1 << "\n";
//cout << "Calc: " << (x1 - x[i]) / 4.0 * r1 * (x1 - x[i]) << "\n";
//cout << "Calc: " << (x1 - x[i]) * (x1 - x[i]) / (4.0 * r1) << "\n";
//cout << "i: " << i << ", dia[i]: " << dia[i] << ", r1: " << r1 << "\n";
if (dia[i] >= r1) stk.pop();
else break;
}
stk.push({ x[i], dia[i] });
}
for (int i = 0; i < n; ++i)
{
cout << fixed << setprecision(3) << dia[i] << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
844 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
2072 KB |
50000 numbers |
2 |
Correct |
55 ms |
3336 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
3348 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
3848 KB |
115362 numbers |
2 |
Correct |
143 ms |
5680 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
4916 KB |
154271 numbers |
2 |
Correct |
206 ms |
12552 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
211 ms |
5784 KB |
200000 numbers |
2 |
Correct |
206 ms |
9316 KB |
199945 numbers |