# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
729865 | saken03 | Balloons (CEOI11_bal) | C++17 | 223 ms | 6976 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
typedef long long ll;
using namespace std;
void setIO(string name = "") {
ios::sync_with_stdio(0);
cin.tie(0);
if (!name.empty()) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
double calc_r(pair<double, double> a, double bx) {
return (a.f - bx) * (a.f - bx) / (4 * a.s);
}
void solve() {
int n;
cin >> n;
vector<double> final_radius(n);
stack<pair<double, double>> to_check;
for (int i = 0; i < n; i++) {
double x, r;
cin >> x >> r;
double max_r = r;
while (!to_check.empty()) {
pair<double, double> last = to_check.top();
double to_last_r = calc_r(last, x);
max_r = min(max_r, to_last_r);
if (max_r >= last.s) {
to_check.pop();
continue;
}
else break;
}
to_check.push({x, max_r});
final_radius[i] = max_r;
}
cout << fixed << setprecision(3);
for (double &r : final_radius) cout << r << '\n';
}
int main() {
setIO("");
solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |