# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
462534 |
2021-08-10T17:42:05 Z |
PandaZGV2 |
Balloons (CEOI11_bal) |
C++17 |
|
182 ms |
8480 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long int ull;
typedef long int li;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define modint int(1e9 + 7)
#define mod 1e9 + 7
#define Inf INFINITY
// =============================Graph Agorithms==================================
// vector<bool> visited;
// void dfs(int v)
// {
// visited[v] = true;
// for (int u : adj[v])
// {
// if (!visited[u])
// dfs(u);
// }
// }
// vector<vector<int>> adj; // adjacency list representation
// int n; // number of nodes
// int s; // source vertex
// queue<int> q;
// vector<bool> used(n);
// vector<int> d(n), p(n);
// q.push(s);
// used[s] = true;
// p[s] = -1;
// while (!q.empty())
// {
// int v = q.front();
// q.pop();
// for (int u : adj[v])
// {
// if (!used[u])
// {
// used[u] = true;
// q.push(u);
// d[u] = d[v] + 1;
// p[u] = v;
// }
// }
// }
#define loop(n) for (int i = 0; i < n; i++)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define file_read \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define tc \
int t; \
cin >> t; \
while (t--)
#define endl "\n"
#define iamspeed \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int main(void)
{
iamspeed;
int n;
cin >> n;
vector<pi> a(n);
for(int i=0;i<n;i++)
{
cin >> a[i].f >> a[i].s;
}
vector<double> radius(n);
stack<int> s;
for(int i=0;i<n;i++)
{
double sz = a[i].s;
while(!s.empty())
{
int top = s.top();
sz = min(sz, pow(a[top].f - a[i].f,2)/(radius[top] * 4));
if(sz >= radius[top])
{
s.pop();
}
else
{
break;
}
}
s.push(i);
radius[i] = sz;
}
for(int i=0;i<n;i++)
{
cout << fixed << setprecision(3);
cout << radius[i] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
900 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
2184 KB |
50000 numbers |
2 |
Correct |
38 ms |
2272 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
4216 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
4872 KB |
115362 numbers |
2 |
Correct |
93 ms |
5256 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
153 ms |
6376 KB |
154271 numbers |
2 |
Correct |
151 ms |
8480 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
182 ms |
7676 KB |
200000 numbers |
2 |
Correct |
163 ms |
8456 KB |
199945 numbers |