Submission #223415

#TimeUsernameProblemLanguageResultExecution timeMemory
223415dolphingarlicBalloons (CEOI11_bal)C++14
100 / 100
173 ms3576 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...