# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
469052 |
2021-08-30T14:30:07 Z |
dawangk |
Balloons (CEOI11_bal) |
C++14 |
|
297 ms |
11744 KB |
#include <bits/stdc++.h>
using namespace std;
//#include <ext/rope>
//using namespace __gnu_cxx;
#include <ext/pb_ds/assoc_container.hpp>
#include <stdlib.h>
using namespace __gnu_pbds;
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#define inputJunk ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug cout<<"HERE"<<endl;
#define ell "\n"
//#define x real()
//#define y imag()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<int, pi> trip;
typedef pair<pll, ll> tripll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<trip> vtrip;
typedef vector<tripll> vtripll;
typedef complex<ll> point;
const int INF = 1e9+1212;
const ll P = 9973, M = 1e9+9;
const int MM = 1e6+5; int mod = 1e9+7;//99824435
int main(){
inputJunk
int n;cin>>n;
vector<pair<ld, ld>> arr;
for(int i= 0;i<n;i++){
ld a, b;
cin>>a>>b;
arr.pb({a, b});
}
stack<pair<ld, ld>> s;
for(int i= 0;i<n;i++){
ld ans = arr[i].s;
while(!s.empty()){
ld a = s.top().f, b= s.top().s;
ans = min(ans, (arr[i].f-a)*(arr[i].f-a)/(4*b));
if(ans>=b)s.pop();
else break;
}
s.push({arr[i].f, ans});
cout<<fixed<<setprecision(3)<<ans<<ell;
}
}
/*CUSTOM TEST CASE 1
*/
/*CUSTOM TEST CASE 2
*/
/*CUSTOM TEST CASE 3
*/
/*Comments of Shame
- floating error (use integer division instead)
- cin vs getline
- upperbound and lowerbound returns iteratorsf
- use long long when number is big enough
- for dp invalid cases needs to be skipped
- some base cases won't work (review cow poetry)
- always check bounds, some TLE are due to incorrect bounds!
- dont mess up return types
= RESET ARRAYS!!!!!!!!!!
- USE UR BRAIN
- INF setting problems
- push vs pb
- check if things are used properly
- read the PROBLEM (directed vs undirected graph)
*/
/*
freopen("time.in","r", stdin);
freopen("time.out","w", stdout);
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
332 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
460 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1612 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
3384 KB |
50000 numbers |
2 |
Correct |
65 ms |
3292 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
5916 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
204 ms |
6932 KB |
115362 numbers |
2 |
Correct |
157 ms |
7280 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
10812 KB |
154271 numbers |
2 |
Correct |
261 ms |
11732 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
274 ms |
10940 KB |
200000 numbers |
2 |
Correct |
297 ms |
11744 KB |
199945 numbers |