답안 #27851

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27851 2017-07-14T08:22:32 Z 김현수(#1159) Sparklers (JOI17_sparklers) C++14
50 / 100
63 ms 9916 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1005, inf = 2e9;
ll n, k, t, a[N], vis[N][N], ts, cs;

void dfs (ll X, ll Y) {
	if(vis[X][Y] == ts || min(inf, cs*t)*(Y-X)*2 < a[Y]-a[X]) return;
	vis[X][Y] = ts;
	if(X != 1) dfs(X-1, Y);
	if(Y != n) dfs(X, Y+1);
}

int main()
{
	scanf("%lld%lld%lld",&n,&k,&t);
	bool f = false;
	for(ll i=1;i<=n;i++) {
		scanf("%lld",&a[i]);
		if(a[i] != a[i-1]) f = true;
	}
	if(!f) {puts("0"); return 0;}
	a[0] = -2*inf; a[n+1] = 2*inf;
	ll S = 1, E = inf;
	while(S<E) {
		ll M = (S+E)/2; cs = M; ts++;
		dfs(k, k);
		vis[1][n] == ts ? E = M : S = M+1;
	}
	printf("%lld\n",S);
}

Compilation message

sparklers.cpp: In function 'int main()':
sparklers.cpp:16:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld",&n,&k,&t);
                                ^
sparklers.cpp:19:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9916 KB Output is correct
2 Correct 0 ms 9916 KB Output is correct
3 Correct 0 ms 9916 KB Output is correct
4 Correct 0 ms 9916 KB Output is correct
5 Correct 0 ms 9916 KB Output is correct
6 Correct 0 ms 9916 KB Output is correct
7 Correct 0 ms 9916 KB Output is correct
8 Correct 0 ms 9916 KB Output is correct
9 Correct 0 ms 9916 KB Output is correct
10 Correct 0 ms 9916 KB Output is correct
11 Correct 0 ms 9916 KB Output is correct
12 Correct 0 ms 9916 KB Output is correct
13 Correct 0 ms 9916 KB Output is correct
14 Correct 0 ms 9916 KB Output is correct
15 Correct 0 ms 9916 KB Output is correct
16 Correct 0 ms 9916 KB Output is correct
17 Correct 0 ms 9916 KB Output is correct
18 Correct 0 ms 9916 KB Output is correct
19 Correct 0 ms 9916 KB Output is correct
20 Correct 0 ms 9916 KB Output is correct
21 Correct 0 ms 9916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9916 KB Output is correct
2 Correct 0 ms 9916 KB Output is correct
3 Correct 0 ms 9916 KB Output is correct
4 Correct 0 ms 9916 KB Output is correct
5 Correct 0 ms 9916 KB Output is correct
6 Correct 0 ms 9916 KB Output is correct
7 Correct 0 ms 9916 KB Output is correct
8 Correct 0 ms 9916 KB Output is correct
9 Correct 0 ms 9916 KB Output is correct
10 Correct 0 ms 9916 KB Output is correct
11 Correct 0 ms 9916 KB Output is correct
12 Correct 0 ms 9916 KB Output is correct
13 Correct 0 ms 9916 KB Output is correct
14 Correct 0 ms 9916 KB Output is correct
15 Correct 0 ms 9916 KB Output is correct
16 Correct 0 ms 9916 KB Output is correct
17 Correct 0 ms 9916 KB Output is correct
18 Correct 0 ms 9916 KB Output is correct
19 Correct 0 ms 9916 KB Output is correct
20 Correct 0 ms 9916 KB Output is correct
21 Correct 0 ms 9916 KB Output is correct
22 Correct 16 ms 9916 KB Output is correct
23 Correct 6 ms 9916 KB Output is correct
24 Correct 3 ms 9916 KB Output is correct
25 Correct 0 ms 9916 KB Output is correct
26 Correct 16 ms 9916 KB Output is correct
27 Correct 16 ms 9916 KB Output is correct
28 Correct 33 ms 9916 KB Output is correct
29 Correct 29 ms 9916 KB Output is correct
30 Correct 23 ms 9916 KB Output is correct
31 Correct 19 ms 9916 KB Output is correct
32 Correct 29 ms 9916 KB Output is correct
33 Correct 39 ms 9916 KB Output is correct
34 Correct 26 ms 9916 KB Output is correct
35 Correct 63 ms 9916 KB Output is correct
36 Correct 9 ms 9916 KB Output is correct
37 Correct 9 ms 9916 KB Output is correct
38 Correct 33 ms 9916 KB Output is correct
39 Correct 6 ms 9916 KB Output is correct
40 Correct 0 ms 9916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9916 KB Output is correct
2 Correct 0 ms 9916 KB Output is correct
3 Correct 0 ms 9916 KB Output is correct
4 Correct 0 ms 9916 KB Output is correct
5 Correct 0 ms 9916 KB Output is correct
6 Correct 0 ms 9916 KB Output is correct
7 Correct 0 ms 9916 KB Output is correct
8 Correct 0 ms 9916 KB Output is correct
9 Correct 0 ms 9916 KB Output is correct
10 Correct 0 ms 9916 KB Output is correct
11 Correct 0 ms 9916 KB Output is correct
12 Correct 0 ms 9916 KB Output is correct
13 Correct 0 ms 9916 KB Output is correct
14 Correct 0 ms 9916 KB Output is correct
15 Correct 0 ms 9916 KB Output is correct
16 Correct 0 ms 9916 KB Output is correct
17 Correct 0 ms 9916 KB Output is correct
18 Correct 0 ms 9916 KB Output is correct
19 Correct 0 ms 9916 KB Output is correct
20 Correct 0 ms 9916 KB Output is correct
21 Correct 0 ms 9916 KB Output is correct
22 Correct 16 ms 9916 KB Output is correct
23 Correct 6 ms 9916 KB Output is correct
24 Correct 3 ms 9916 KB Output is correct
25 Correct 0 ms 9916 KB Output is correct
26 Correct 16 ms 9916 KB Output is correct
27 Correct 16 ms 9916 KB Output is correct
28 Correct 33 ms 9916 KB Output is correct
29 Correct 29 ms 9916 KB Output is correct
30 Correct 23 ms 9916 KB Output is correct
31 Correct 19 ms 9916 KB Output is correct
32 Correct 29 ms 9916 KB Output is correct
33 Correct 39 ms 9916 KB Output is correct
34 Correct 26 ms 9916 KB Output is correct
35 Correct 63 ms 9916 KB Output is correct
36 Correct 9 ms 9916 KB Output is correct
37 Correct 9 ms 9916 KB Output is correct
38 Correct 33 ms 9916 KB Output is correct
39 Correct 6 ms 9916 KB Output is correct
40 Correct 0 ms 9916 KB Output is correct
41 Runtime error 0 ms 9916 KB Execution killed because of forbidden syscall futex (202)
42 Halted 0 ms 0 KB -