# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
693430 |
2023-02-03T03:26:30 Z |
yuuCG |
Balloons (CEOI11_bal) |
C++17 |
|
187 ms |
7028 KB |
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define TASK "mincut"
#define ll long long
#define MAXN 1000006
#define pii pair<long long,long long>
#define pdd pair<double, double>
#define ppi pair<ll,pii>
#define ff first
#define ss second
#define pb push_back
#define oo 1e18
using namespace std;
const ll MOD=1e9+7;
bool minimize(ll &a,ll b)
{
if (a>b)
{
a=b;
return true;
}
return false;
}
bool maximize (ll &a,ll b)
{
if (a<b)
{
a=b;
return true;
}
return false;
}
ll n;
void nhap()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
}
double calc(pdd x,double y)
{
return ((x.ff-y)*(x.ff-y))/(4*1.0*x.ss);
}
void solve()
{
vector<double> ans;
ans.resize(n+5);
stack<pdd> check;
FOR(i,1,n)
{
double x,r;
cin >> x >> r;
double max_r=r;
while (!check.empty())
{
pdd last=check.top();
double last_r=calc(last,x);
max_r=min(max_r,last_r);
if (max_r>=last.ss)
{
check.pop();
continue;
}
else break;
}
check.push({x,max_r});
ans[i]=max_r;
}
FOR(i,1,n) cout << fixed << setprecision(3) << ans[i] << '\n';
}
int main()
{
nhap();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 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 |
20 ms |
852 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
2032 KB |
50000 numbers |
2 |
Correct |
51 ms |
1964 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
3528 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
4104 KB |
115362 numbers |
2 |
Correct |
107 ms |
4304 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
155 ms |
5212 KB |
154271 numbers |
2 |
Correct |
178 ms |
6976 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
187 ms |
6232 KB |
200000 numbers |
2 |
Correct |
186 ms |
7028 KB |
199945 numbers |