Submission #485099

# Submission time Handle Problem Language Result Execution time Memory
485099 2021-11-06T07:45:19 Z largefence Balloons (CEOI11_bal) C++17
60 / 100
2000 ms 4228 KB
#include <bits/stdc++.h>
using namespace std;

#define pw2(x) ((x)*(x))

double x[200000], r[200000], pck[200000];
int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //freopen("ws.INP", "r", stdin);
	//freopen("ws.OUT", "w", stdout);

	int n; scanf("%d", &n);
	for (int i = 0; i < n; i++)
        scanf("%lf %lf", &x[i], &r[i]);//cin >> x[i] >> r[i];
    pck[0] = r[0]; printf("%.3lf\n", pck[0]);
    int jj = 0;
    for (int i = 1; i < n; i++) {
        pck[i] = r[i];
        /*
        if distance between 2 center < sum of rad of circles => intersect
        ^ <=> sqrt((x[i] - x[j])^2 + (h[i] - h[j])^2) == h[i] + h[j] => maximal
        */
        for (int j = jj; j < i; j++)
            pck[i] = min(pck[i], pw2(x[i] - x[j]) / (4.0 * pck[j]));
        printf("%.3lf\n", pck[i]);
    }
    return 0;
}

// How to AC ?

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  int n; scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
bal.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lf %lf", &x[i], &r[i]);//cin >> x[i] >> r[i];
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 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 4 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 351 ms 804 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 1917 ms 1936 KB 50000 numbers
2 Correct 1833 ms 2012 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 2796 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 3020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2083 ms 3796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2092 ms 4228 KB Time limit exceeded
2 Halted 0 ms 0 KB -