This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(ll dist, ld r) {
return ((ld)(dist * dist)) / (4 * r);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
ll n; cin >> n;
stack<pair<ll, ld>> s;
cout << fixed << setprecision(3);
for (ll i = 0; i < n; i++) {
ll pos; ld r; cin >> pos >> r;
while(!s.empty()) {
ll 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |