Submission #59790

# Submission time Handle Problem Language Result Execution time Memory
59790 2018-07-23T06:25:23 Z 윤교준(#1726) Sparklers (JOI17_sparklers) C++11
50 / 100
79 ms 1532 KB
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;

const int MAXN = 1005;

bitset<MAXN> chk[MAXN];

int A[MAXN];

int N, K, T;

bool isp(int P) {
	for(int i = 1; i <= N; i++) chk[i].reset();

	chk[K][K] = true;
	for(int l = 0; l < N; l++) {
		for(int i = 1, j = i+l; j <= N; i++, j++) {
			if(!chk[i][j]) continue;
			if(1 < i && ll(A[j]) - 2ll * P * T * j <= ll(A[i-1]) - 2ll * P * T * (i-1))
				chk[i-1][j] = true;
			if(j < N && ll(A[j+1]) - 2ll * P * T * (j+1) <= ll(A[i]) - 2ll * P * T * i)
				chk[i][j+1] = true;
		}
	}

	return chk[1][N];
}

int getAns() {
	int s = 0, e = INF/T+2; for(int m; s < e;) {
		m = (s+e) >> 1;
		if(isp(m)) e = m;
		else s = m+1;
	}
	return s;
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> K >> T;
	for(int i = 1; i <= N; i++) cin >> A[i];

	cout << getAns() << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 580 KB Output is correct
3 Correct 2 ms 580 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 3 ms 668 KB Output is correct
6 Correct 2 ms 668 KB Output is correct
7 Correct 2 ms 668 KB Output is correct
8 Correct 3 ms 668 KB Output is correct
9 Correct 2 ms 668 KB Output is correct
10 Correct 3 ms 668 KB Output is correct
11 Correct 3 ms 668 KB Output is correct
12 Correct 4 ms 668 KB Output is correct
13 Correct 3 ms 668 KB Output is correct
14 Correct 3 ms 668 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 668 KB Output is correct
17 Correct 2 ms 740 KB Output is correct
18 Correct 3 ms 740 KB Output is correct
19 Correct 2 ms 740 KB Output is correct
20 Correct 2 ms 740 KB Output is correct
21 Correct 3 ms 740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 580 KB Output is correct
3 Correct 2 ms 580 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 3 ms 668 KB Output is correct
6 Correct 2 ms 668 KB Output is correct
7 Correct 2 ms 668 KB Output is correct
8 Correct 3 ms 668 KB Output is correct
9 Correct 2 ms 668 KB Output is correct
10 Correct 3 ms 668 KB Output is correct
11 Correct 3 ms 668 KB Output is correct
12 Correct 4 ms 668 KB Output is correct
13 Correct 3 ms 668 KB Output is correct
14 Correct 3 ms 668 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 668 KB Output is correct
17 Correct 2 ms 740 KB Output is correct
18 Correct 3 ms 740 KB Output is correct
19 Correct 2 ms 740 KB Output is correct
20 Correct 2 ms 740 KB Output is correct
21 Correct 3 ms 740 KB Output is correct
22 Correct 28 ms 740 KB Output is correct
23 Correct 31 ms 740 KB Output is correct
24 Correct 28 ms 740 KB Output is correct
25 Correct 46 ms 892 KB Output is correct
26 Correct 58 ms 892 KB Output is correct
27 Correct 65 ms 892 KB Output is correct
28 Correct 64 ms 892 KB Output is correct
29 Correct 72 ms 892 KB Output is correct
30 Correct 55 ms 892 KB Output is correct
31 Correct 60 ms 892 KB Output is correct
32 Correct 69 ms 892 KB Output is correct
33 Correct 68 ms 892 KB Output is correct
34 Correct 65 ms 892 KB Output is correct
35 Correct 72 ms 892 KB Output is correct
36 Correct 42 ms 892 KB Output is correct
37 Correct 51 ms 892 KB Output is correct
38 Correct 79 ms 892 KB Output is correct
39 Correct 60 ms 892 KB Output is correct
40 Correct 74 ms 892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 580 KB Output is correct
3 Correct 2 ms 580 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 3 ms 668 KB Output is correct
6 Correct 2 ms 668 KB Output is correct
7 Correct 2 ms 668 KB Output is correct
8 Correct 3 ms 668 KB Output is correct
9 Correct 2 ms 668 KB Output is correct
10 Correct 3 ms 668 KB Output is correct
11 Correct 3 ms 668 KB Output is correct
12 Correct 4 ms 668 KB Output is correct
13 Correct 3 ms 668 KB Output is correct
14 Correct 3 ms 668 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 2 ms 668 KB Output is correct
17 Correct 2 ms 740 KB Output is correct
18 Correct 3 ms 740 KB Output is correct
19 Correct 2 ms 740 KB Output is correct
20 Correct 2 ms 740 KB Output is correct
21 Correct 3 ms 740 KB Output is correct
22 Correct 28 ms 740 KB Output is correct
23 Correct 31 ms 740 KB Output is correct
24 Correct 28 ms 740 KB Output is correct
25 Correct 46 ms 892 KB Output is correct
26 Correct 58 ms 892 KB Output is correct
27 Correct 65 ms 892 KB Output is correct
28 Correct 64 ms 892 KB Output is correct
29 Correct 72 ms 892 KB Output is correct
30 Correct 55 ms 892 KB Output is correct
31 Correct 60 ms 892 KB Output is correct
32 Correct 69 ms 892 KB Output is correct
33 Correct 68 ms 892 KB Output is correct
34 Correct 65 ms 892 KB Output is correct
35 Correct 72 ms 892 KB Output is correct
36 Correct 42 ms 892 KB Output is correct
37 Correct 51 ms 892 KB Output is correct
38 Correct 79 ms 892 KB Output is correct
39 Correct 60 ms 892 KB Output is correct
40 Correct 74 ms 892 KB Output is correct
41 Runtime error 13 ms 1532 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Halted 0 ms 0 KB -