Submission #465032

# Submission time Handle Problem Language Result Execution time Memory
465032 2021-08-14T21:32:03 Z JovanB Balloons (CEOI11_bal) C++17
100 / 100
227 ms 5444 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
ld resi(ld d, ld r){
    return d*d/4/r;
}
 
int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(3);
    cout << fixed;
 
	int n;
	cin >> n;
	stack <pair <int, ld>> stek;
	for(int i=1; i<=n; i++){
        int x;
        ld r;
        cin >> x >> r;
        while(!stek.empty()){
            int x1 = stek.top().first;
            ld r1 = stek.top().second;
            int d = x-x1;
            r = min(r, resi(d, r1));
            if(r >= r1) stek.pop();
            else break;
        }
        cout << r << "\n";
        stek.push({x, r});
	}
    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 204 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 320 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 27 ms 756 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 58 ms 1704 KB 50000 numbers
2 Correct 55 ms 1580 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 120 ms 2792 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 140 ms 3348 KB 115362 numbers
2 Correct 146 ms 3320 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 189 ms 4092 KB 154271 numbers
2 Correct 213 ms 5404 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 227 ms 4668 KB 200000 numbers
2 Correct 220 ms 5444 KB 199945 numbers