Submission #1000155

# Submission time Handle Problem Language Result Execution time Memory
1000155 2024-06-16T18:13:18 Z vjudge1 Sparklers (JOI17_sparklers) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define inf 0x3F3F3F3F3F3F3F3F

const int MXN = 1e5 + 5;

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k, t;
	cin >> n >> k >> t;
	k--;
	int x[n];
	for (int &i : x) cin >> i;
	int l = 0, r = inf;
	while (l < r)
	{
		int mid = (l + r) >> 1;
		int L = k - 1, R = k + 1;
		while (R - L - 1 < n)
		{
			if (L >= 0 && (R >= n || x[L + 1] - x[L] <= x[R] - x[R - 1]) && !((x[R - 1] - x[L] + mid * 2 - 1) / (mid * 2) > (R - L - 1) * t))
			{
				L--;
			}
			else if (R < n && (L < 0 || x[L + 1] - x[L] >= x[R] - x[R - 1]) && !((x[R] - x[L + 1] + mid * 2 - 1) / (mid * 2) > (R - L - 1) * t))
			{
				R++;
			}
			else break;
		}
		if ((R - L - 1) == n) r = mid;
		else l = mid + 1;
	}
	cout << l << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Halted 0 ms 0 KB -