# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
570658 |
2022-05-30T23:41:23 Z |
RandomLB |
Balloons (CEOI11_bal) |
C++17 |
|
246 ms |
6732 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
template<class T> using indexed_set = tree<T, null_type, less_equal<T>,
rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order //(k-indexed val with 0-indexing)
#define ook order_of_key //(num of vals in set that are strictly less)
#define ms(x, a) memset(x, a, sizeof(x))
#define siz(x) (int)x.size()
#define len(x) (int)x.length()
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vals, Args&&... values){
cout << vals << " = ";
string delim = "";
(...,(cout << delim << values, delim = ", "));
cout << endl;
}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9+7;
//===========================================
inline ld lim(ld pp, pair<ld, ld> cir){
return (cir.F-pp)*(cir.F-pp)/(4*cir.S);
}
int main(){
cin.tie(0)->sync_with_stdio(0);
//freopen("test.txt", "r", stdin);
int n; cin >> n;
vector<pair<ld, ld>> q;
for (int i = 1; i <= n; i++){
ld x, r; cin >> x >> r;
while (siz(q)){
r = min(r, lim(x, q.back()));
if (r >= q.back().S) q.pop_back();
else break;
}
cout << fixed << setprecision(9) << r << "\n";
q.push_back({x, r});
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
588 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
1484 KB |
50000 numbers |
2 |
Correct |
58 ms |
1952 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
125 ms |
2152 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
2472 KB |
115362 numbers |
2 |
Correct |
139 ms |
4224 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
200 ms |
2908 KB |
154271 numbers |
2 |
Correct |
222 ms |
6660 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
246 ms |
3184 KB |
200000 numbers |
2 |
Correct |
219 ms |
6732 KB |
199945 numbers |