Submission #906191

# Submission time Handle Problem Language Result Execution time Memory
906191 2024-01-13T15:17:48 Z Mikhail Mobile (BOI12_mobile) C++14
8 / 100
764 ms 16064 KB
#include <iostream>
#include <math.h>
#define MAX_N 1000000
double x[MAX_N], y[MAX_N];
#define MAX(a,b)  ((a > b) ? a : b)

using namespace std;

int main() {
	int N;
	cin >> N;
	double L;
	cin >> L;

	cin >> x[0] >> y[0];
	y[0] = y[0] * y[0];
	int ni = 1;
	for (int i = 1; i < N; i++) {
		cin >> x[ni] >> y[ni];
		if (x[ni] == x[ni - 1]) {
			if (y[ni] * y[ni] < y[ni - 1]) {
				x[ni - 1] = x[ni];
				y[ni - 1] = y[ni] * y[ni];
			}
		}
		else {
			y[ni] = y[ni] * y[ni];
			ni++;
		}
	}


	double l = 0., m, r = 1e9, m_sqr, c, t0, tn, tp;
	while(r - l > 0.001) {
		m = l / 2 + r / 2;
		m_sqr = m * m;
		c = 0.;
		for (int j = 0; j < ni; j++) {
			if (m_sqr < y[j]) continue;
			t0 = sqrt(m_sqr - y[j]);
			tn = x[j] - t0;
			if (tn > c) continue;
			t0 += x[j];
			c = MAX(t0, c);
		}
		//cout << c << ' ' << l << ' ' << r << ' ' << min_t <<  '\n';
		if (c > L) r = m;
		else l = m;
	}
	cout << l / 2 + r / 2 << '\n';
	return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:33:47: warning: unused variable 'tp' [-Wunused-variable]
   33 |  double l = 0., m, r = 1e9, m_sqr, c, t0, tn, tp;
      |                                               ^~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2396 KB Output is correct
2 Correct 3 ms 2392 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Incorrect 3 ms 2396 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Incorrect 5 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2396 KB Output is correct
2 Incorrect 5 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2396 KB Output is correct
2 Incorrect 5 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 4700 KB Output is correct
2 Incorrect 69 ms 4700 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 2488 KB Output is correct
2 Correct 50 ms 4948 KB Output is correct
3 Incorrect 65 ms 4700 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 62 ms 6760 KB Output is correct
2 Incorrect 78 ms 4696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 4640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 6752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 352 ms 10856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 2548 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 418 ms 14956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 450 ms 2484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 474 ms 14960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 528 ms 2736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 543 ms 14948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 605 ms 2500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 703 ms 16064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 764 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -