답안 #55327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55327 2018-07-07T03:10:09 Z ksun48 Sparklers (JOI17_sparklers) C++14
50 / 100
37 ms 5512 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main(){
	cin.sync_with_stdio(0); cin.tie(0);
	LL n, k, t;
	cin >> n >> k >> t;
	k--;
	vector<LL> x(n);
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	LL equal = 1;
	for(int i = 0; i < n; i++){
		if(x[i] != x[i]){
			equal = 0;
		}
	}

	LL s = -1; // cant
	LL e = 1000000000;
	while(s + 1 < e){
		LL m = (s + e) / 2;
		LL cover = m * t * 2;
		LL dp[n][n];
		for(LL i = k; i >= 0; i--){
			for(LL j = k; j < n; j++){
				dp[i][j] = 0;
				if(x[j]-x[i] > (j-i) * cover){
					continue;
				}
				if(i == k && j == k){
					dp[i][j] = 1;
					continue;
				}
				if(i < k && dp[i+1][j]){
					dp[i][j] = 1;
				}
				if(j > k && dp[i][j-1]){
					dp[i][j] = 1;
				}
			}
		}
		if(dp[0][n-1]){
			e = m;
		} else {
			s = m;
		}
	}
	cout << e << '\n';
}

Compilation message

sparklers.cpp: In function 'int main()':
sparklers.cpp:15:5: warning: variable 'equal' set but not used [-Wunused-but-set-variable]
  LL equal = 1;
     ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 3 ms 656 KB Output is correct
8 Correct 3 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 2 ms 656 KB Output is correct
13 Correct 2 ms 708 KB Output is correct
14 Correct 2 ms 728 KB Output is correct
15 Correct 3 ms 732 KB Output is correct
16 Correct 2 ms 736 KB Output is correct
17 Correct 3 ms 740 KB Output is correct
18 Correct 3 ms 744 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 3 ms 868 KB Output is correct
21 Correct 2 ms 868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 3 ms 656 KB Output is correct
8 Correct 3 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 2 ms 656 KB Output is correct
13 Correct 2 ms 708 KB Output is correct
14 Correct 2 ms 728 KB Output is correct
15 Correct 3 ms 732 KB Output is correct
16 Correct 2 ms 736 KB Output is correct
17 Correct 3 ms 740 KB Output is correct
18 Correct 3 ms 744 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 3 ms 868 KB Output is correct
21 Correct 2 ms 868 KB Output is correct
22 Correct 19 ms 2168 KB Output is correct
23 Correct 9 ms 2168 KB Output is correct
24 Correct 6 ms 2168 KB Output is correct
25 Correct 4 ms 2168 KB Output is correct
26 Correct 16 ms 2168 KB Output is correct
27 Correct 17 ms 2168 KB Output is correct
28 Correct 26 ms 5092 KB Output is correct
29 Correct 26 ms 5232 KB Output is correct
30 Correct 19 ms 5244 KB Output is correct
31 Correct 21 ms 5400 KB Output is correct
32 Correct 37 ms 5400 KB Output is correct
33 Correct 24 ms 5400 KB Output is correct
34 Correct 17 ms 5400 KB Output is correct
35 Correct 21 ms 5512 KB Output is correct
36 Correct 7 ms 5512 KB Output is correct
37 Correct 10 ms 5512 KB Output is correct
38 Correct 21 ms 5512 KB Output is correct
39 Correct 9 ms 5512 KB Output is correct
40 Correct 37 ms 5512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 460 KB Output is correct
3 Correct 2 ms 460 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 3 ms 656 KB Output is correct
8 Correct 3 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 2 ms 656 KB Output is correct
13 Correct 2 ms 708 KB Output is correct
14 Correct 2 ms 728 KB Output is correct
15 Correct 3 ms 732 KB Output is correct
16 Correct 2 ms 736 KB Output is correct
17 Correct 3 ms 740 KB Output is correct
18 Correct 3 ms 744 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 3 ms 868 KB Output is correct
21 Correct 2 ms 868 KB Output is correct
22 Correct 19 ms 2168 KB Output is correct
23 Correct 9 ms 2168 KB Output is correct
24 Correct 6 ms 2168 KB Output is correct
25 Correct 4 ms 2168 KB Output is correct
26 Correct 16 ms 2168 KB Output is correct
27 Correct 17 ms 2168 KB Output is correct
28 Correct 26 ms 5092 KB Output is correct
29 Correct 26 ms 5232 KB Output is correct
30 Correct 19 ms 5244 KB Output is correct
31 Correct 21 ms 5400 KB Output is correct
32 Correct 37 ms 5400 KB Output is correct
33 Correct 24 ms 5400 KB Output is correct
34 Correct 17 ms 5400 KB Output is correct
35 Correct 21 ms 5512 KB Output is correct
36 Correct 7 ms 5512 KB Output is correct
37 Correct 10 ms 5512 KB Output is correct
38 Correct 21 ms 5512 KB Output is correct
39 Correct 9 ms 5512 KB Output is correct
40 Correct 37 ms 5512 KB Output is correct
41 Runtime error 16 ms 5512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Halted 0 ms 0 KB -