Submission #722669

# Submission time Handle Problem Language Result Execution time Memory
722669 2023-04-12T14:34:34 Z Macker Balloons (CEOI11_bal) C++14
20 / 100
250 ms 6544 KB
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <math.h>
#include <tuple>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <climits>
#include <fstream>
#include <cassert>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()

ld getR(int dist, ld r) {
	return (ld)(dist * dist) / (4 * r);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
    int n; cin >> n;
	stack<pair<int, ld>> s;
	cout << fixed << setprecision(3);
	for (int i = 0; i < n; i++) {
		int pos; ld r; cin >> pos >> r;
		while(!s.empty()) {
			int d = pos - s.top().first;
			r = min(getR(d, s.top().second), r);
			if (r < s.top().second) break;
			else s.pop(); 
		}
		cout << r << "\n";
		s.push({ pos, r });
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 260 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 324 KB 506th numbers differ - expected: '365.0000000000', found: '-2481854.0649999999', error = '2482219.0649999999'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 852 KB 655th numbers differ - expected: '591.0000000000', found: '-2402336.3029999998', error = '2402927.3029999998'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 1720 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 3372 KB 7234th numbers differ - expected: '7160.0000000000', found: '-2398141.9989999998', error = '2405301.9989999998'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 139 ms 3664 KB 4643rd numbers differ - expected: '2427.0000000000', found: '-2355611.7020000000', error = '2358038.7020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 187 ms 4880 KB 1734th numbers differ - expected: '1856.0220000000', found: '-2324667.3859999999', error = '2326523.4079999998'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 250 ms 6544 KB 2723rd numbers differ - expected: '859.0470000000', found: '-2333711.4849999999', error = '2334570.5319999997'
2 Halted 0 ms 0 KB -