Submission #223415

# Submission time Handle Problem Language Result Execution time Memory
223415 2020-04-15T08:56:25 Z dolphingarlic Balloons (CEOI11_bal) C++14
100 / 100
173 ms 3576 KB
#include <bits/stdc++.h>
using namespace std;

stack<pair<double, double>> stck;

int main() {
	int n;
	scanf("%d", &n);
	while (n--) {
		double x, r;
		scanf("%lf %lf", &x, &r);
		while (stck.size()) {
			r = min(r, (x - stck.top().first) * (x - stck.top().first) / stck.top().second / 4);
			if (r > stck.top().second) stck.pop();
			else break;
		}
		stck.push({x, r});
		printf("%.3lf\n", r);
	}
	return 0;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
bal.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf", &x, &r);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 22 ms 640 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 53 ms 1144 KB 50000 numbers
2 Correct 43 ms 1144 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 98 ms 1400 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 108 ms 1656 KB 115362 numbers
2 Correct 92 ms 2168 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 152 ms 1956 KB 154271 numbers
2 Correct 159 ms 3576 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 173 ms 2040 KB 200000 numbers
2 Correct 167 ms 3576 KB 199945 numbers