답안 #46893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
46893 2018-04-24T14:50:35 Z SpaimaCarpatilor Sparklers (JOI17_sparklers) C++17
50 / 100
36 ms 10228 KB
#include<bits/stdc++.h>

using namespace std;

int N, K, T, x[100009];
bool dp[2018][2018];

bool ok (int S)
{
    memset (dp, 0, sizeof (dp));
    dp[K][K] = 1;///j is the last visited
    for (int i=K; i>=1; i--)
        for (int j=K; j<=N; j++)
        {
            if (x[j] - x[i] > 2LL * S * T * (j - i) || dp[i][j] == 0)
            {
                dp[i][j] = 0;
                continue;
            }
            dp[i - 1][j] |= dp[i][j], dp[i][j + 1] |= dp[i][j];
        }
    return dp[1][N];
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d %d", &N, &K, &T);
for (int i=1; i<=N; i++)
    scanf ("%d", &x[i]);
int p = 0, u = (x[N] - x[1]) / T + 1, mij, ras = -1;
while (p <= u)
{
    mij = (p + u) >> 1;
    if (ok (mij)) ras = mij, u = mij - 1;
    else p = mij + 1;
}
printf ("%d\n", ras);
return 0;
}

Compilation message

sparklers.cpp: In function 'int main()':
sparklers.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d %d %d", &N, &K, &T);
 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sparklers.cpp:32:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d", &x[i]);
     ~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 4344 KB Output is correct
2 Correct 10 ms 4456 KB Output is correct
3 Correct 10 ms 4456 KB Output is correct
4 Correct 11 ms 4456 KB Output is correct
5 Correct 11 ms 4456 KB Output is correct
6 Correct 10 ms 4456 KB Output is correct
7 Correct 10 ms 4456 KB Output is correct
8 Correct 11 ms 4456 KB Output is correct
9 Correct 10 ms 4504 KB Output is correct
10 Correct 10 ms 4504 KB Output is correct
11 Correct 9 ms 4504 KB Output is correct
12 Correct 9 ms 4504 KB Output is correct
13 Correct 9 ms 4508 KB Output is correct
14 Correct 9 ms 4632 KB Output is correct
15 Correct 9 ms 4632 KB Output is correct
16 Correct 10 ms 4632 KB Output is correct
17 Correct 9 ms 4632 KB Output is correct
18 Correct 9 ms 4632 KB Output is correct
19 Correct 4 ms 4632 KB Output is correct
20 Correct 10 ms 4632 KB Output is correct
21 Correct 4 ms 4640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 4344 KB Output is correct
2 Correct 10 ms 4456 KB Output is correct
3 Correct 10 ms 4456 KB Output is correct
4 Correct 11 ms 4456 KB Output is correct
5 Correct 11 ms 4456 KB Output is correct
6 Correct 10 ms 4456 KB Output is correct
7 Correct 10 ms 4456 KB Output is correct
8 Correct 11 ms 4456 KB Output is correct
9 Correct 10 ms 4504 KB Output is correct
10 Correct 10 ms 4504 KB Output is correct
11 Correct 9 ms 4504 KB Output is correct
12 Correct 9 ms 4504 KB Output is correct
13 Correct 9 ms 4508 KB Output is correct
14 Correct 9 ms 4632 KB Output is correct
15 Correct 9 ms 4632 KB Output is correct
16 Correct 10 ms 4632 KB Output is correct
17 Correct 9 ms 4632 KB Output is correct
18 Correct 9 ms 4632 KB Output is correct
19 Correct 4 ms 4632 KB Output is correct
20 Correct 10 ms 4632 KB Output is correct
21 Correct 4 ms 4640 KB Output is correct
22 Correct 18 ms 4688 KB Output is correct
23 Correct 15 ms 4688 KB Output is correct
24 Correct 12 ms 4736 KB Output is correct
25 Correct 12 ms 4736 KB Output is correct
26 Correct 19 ms 4760 KB Output is correct
27 Correct 20 ms 4788 KB Output is correct
28 Correct 28 ms 4804 KB Output is correct
29 Correct 26 ms 4812 KB Output is correct
30 Correct 22 ms 4824 KB Output is correct
31 Correct 28 ms 4836 KB Output is correct
32 Correct 36 ms 4848 KB Output is correct
33 Correct 28 ms 4860 KB Output is correct
34 Correct 19 ms 4872 KB Output is correct
35 Correct 28 ms 4936 KB Output is correct
36 Correct 16 ms 4936 KB Output is correct
37 Correct 36 ms 5036 KB Output is correct
38 Correct 26 ms 5036 KB Output is correct
39 Correct 16 ms 5092 KB Output is correct
40 Correct 5 ms 5092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 4344 KB Output is correct
2 Correct 10 ms 4456 KB Output is correct
3 Correct 10 ms 4456 KB Output is correct
4 Correct 11 ms 4456 KB Output is correct
5 Correct 11 ms 4456 KB Output is correct
6 Correct 10 ms 4456 KB Output is correct
7 Correct 10 ms 4456 KB Output is correct
8 Correct 11 ms 4456 KB Output is correct
9 Correct 10 ms 4504 KB Output is correct
10 Correct 10 ms 4504 KB Output is correct
11 Correct 9 ms 4504 KB Output is correct
12 Correct 9 ms 4504 KB Output is correct
13 Correct 9 ms 4508 KB Output is correct
14 Correct 9 ms 4632 KB Output is correct
15 Correct 9 ms 4632 KB Output is correct
16 Correct 10 ms 4632 KB Output is correct
17 Correct 9 ms 4632 KB Output is correct
18 Correct 9 ms 4632 KB Output is correct
19 Correct 4 ms 4632 KB Output is correct
20 Correct 10 ms 4632 KB Output is correct
21 Correct 4 ms 4640 KB Output is correct
22 Correct 18 ms 4688 KB Output is correct
23 Correct 15 ms 4688 KB Output is correct
24 Correct 12 ms 4736 KB Output is correct
25 Correct 12 ms 4736 KB Output is correct
26 Correct 19 ms 4760 KB Output is correct
27 Correct 20 ms 4788 KB Output is correct
28 Correct 28 ms 4804 KB Output is correct
29 Correct 26 ms 4812 KB Output is correct
30 Correct 22 ms 4824 KB Output is correct
31 Correct 28 ms 4836 KB Output is correct
32 Correct 36 ms 4848 KB Output is correct
33 Correct 28 ms 4860 KB Output is correct
34 Correct 19 ms 4872 KB Output is correct
35 Correct 28 ms 4936 KB Output is correct
36 Correct 16 ms 4936 KB Output is correct
37 Correct 36 ms 5036 KB Output is correct
38 Correct 26 ms 5036 KB Output is correct
39 Correct 16 ms 5092 KB Output is correct
40 Correct 5 ms 5092 KB Output is correct
41 Runtime error 19 ms 10228 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Halted 0 ms 0 KB -