# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
869192 |
2023-11-03T12:54:07 Z |
tvladm2009 |
Balloons (CEOI11_bal) |
C++17 |
|
2000 ms |
10184 KB |
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <cassert>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)2e5 + 7;
ld x[N], r[N], rad[N];
int n;
struct Circle {
ld x;
ld y;
ld radius;
};
bool check(Circle a, Circle b) {
ld d = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
if (d <= (a.radius + b.radius) * (a.radius + b.radius)) {
return false;
}
return true;
}
int main() {
#ifndef ONPC
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#else
FILE* stream;
freopen("input.txt", "r", stdin);
#endif
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> r[i];
}
rad[1] = r[1];
for (int i = 2; i <= n; i++) {
ld best = r[i];
for (int j = max(1, i - 50); j < i; j++) {
ld lo = 0.0, hi = r[i], sol = 0.0;
for (int step = 1; step <= 100; step++) {
ld mi = (lo + hi) / 2;
if (check(Circle{rad[j], x[j], rad[j]}, Circle{mi, x[i], mi})) {
lo = mi + 1;
sol = mi;
}
else {
hi = mi - 1;
}
}
best = min(best, sol);
}
rad[i] = best;
}
for (int i = 1; i <= n; i++) {
cout << setprecision(10) << fixed << rad[i] << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4452 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
4444 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
4600 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
621 ms |
9256 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1502 ms |
9608 KB |
14191st numbers differ - expected: '1.9320000000', found: '9.0000000000', error = '7.0680000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2053 ms |
8788 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2025 ms |
8824 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2003 ms |
9568 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2016 ms |
10184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |