Submission #739837

# Submission time Handle Problem Language Result Execution time Memory
739837 2023-05-11T11:33:42 Z blue Sparklers (JOI17_sparklers) C++17
50 / 100
187 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvll = vector<vll>;
using vvi = vector<vi>;

#define sz(x) int(x.size())

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N, K, T;
	cin >> N >> K >> T;

	vll X(1+N);
	for(int i = 1; i <= N; i++)
	{
		cin >> X[i];
	}



	ll lo = -1, hi = ((((1'000'000'000'000'000'000LL / 2LL + 1) / N) + 1) / T) + 1; 
	// ll lo = 1, hi = 1'000'000'000'000'000'000LL/N;
	while(hi - lo > 1)
	{
		ll mid = (lo + hi)/2;

		vvll dp(1+N, vll(1+N, 0));

		// for(ll l = N; l >= 1; l--)
		for(ll l = K; l >= 1; l--)
		{
			for(ll r = K; r <= N; r++)
			{
				if(l == r)
					dp[l][r] = 1;
				else if(2LL * T * (r-l) * mid < X[r] - X[l])
				// else if(2LL * (r-l) * mid < X[r] - X[l])
					dp[l][r] = 0;
				else
					dp[l][r] = dp[l+1][r] || dp[l][r-1];
			}
		}

		if(dp[1][N] == 1)
			hi = mid;
		else
			lo = mid;
	}

	cout << hi << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 85 ms 4720 KB Output is correct
23 Correct 44 ms 3016 KB Output is correct
24 Correct 67 ms 4692 KB Output is correct
25 Correct 154 ms 8488 KB Output is correct
26 Correct 156 ms 8368 KB Output is correct
27 Correct 153 ms 8548 KB Output is correct
28 Correct 187 ms 8328 KB Output is correct
29 Correct 175 ms 8296 KB Output is correct
30 Correct 174 ms 8380 KB Output is correct
31 Correct 169 ms 8272 KB Output is correct
32 Correct 187 ms 8372 KB Output is correct
33 Correct 182 ms 8332 KB Output is correct
34 Correct 156 ms 8404 KB Output is correct
35 Correct 169 ms 8476 KB Output is correct
36 Correct 152 ms 8376 KB Output is correct
37 Correct 151 ms 8580 KB Output is correct
38 Correct 168 ms 8364 KB Output is correct
39 Correct 157 ms 8412 KB Output is correct
40 Correct 167 ms 8292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 316 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 85 ms 4720 KB Output is correct
23 Correct 44 ms 3016 KB Output is correct
24 Correct 67 ms 4692 KB Output is correct
25 Correct 154 ms 8488 KB Output is correct
26 Correct 156 ms 8368 KB Output is correct
27 Correct 153 ms 8548 KB Output is correct
28 Correct 187 ms 8328 KB Output is correct
29 Correct 175 ms 8296 KB Output is correct
30 Correct 174 ms 8380 KB Output is correct
31 Correct 169 ms 8272 KB Output is correct
32 Correct 187 ms 8372 KB Output is correct
33 Correct 182 ms 8332 KB Output is correct
34 Correct 156 ms 8404 KB Output is correct
35 Correct 169 ms 8476 KB Output is correct
36 Correct 152 ms 8376 KB Output is correct
37 Correct 151 ms 8580 KB Output is correct
38 Correct 168 ms 8364 KB Output is correct
39 Correct 157 ms 8412 KB Output is correct
40 Correct 167 ms 8292 KB Output is correct
41 Runtime error 111 ms 262144 KB Execution killed with signal 9
42 Halted 0 ms 0 KB -