Submission #46890

# Submission time Handle Problem Language Result Execution time Memory
46890 2018-04-24T14:45:36 Z SpaimaCarpatilor Sparklers (JOI17_sparklers) C++17
0 / 100
13 ms 4772 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) && 2LL * S * T <= 1000000000) || 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 = 1, u = 1e9, 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]);
     ~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 4344 KB Output is correct
2 Correct 11 ms 4464 KB Output is correct
3 Correct 12 ms 4536 KB Output is correct
4 Correct 12 ms 4536 KB Output is correct
5 Correct 11 ms 4536 KB Output is correct
6 Correct 11 ms 4536 KB Output is correct
7 Correct 11 ms 4536 KB Output is correct
8 Correct 11 ms 4560 KB Output is correct
9 Correct 12 ms 4564 KB Output is correct
10 Correct 11 ms 4608 KB Output is correct
11 Correct 11 ms 4632 KB Output is correct
12 Correct 11 ms 4636 KB Output is correct
13 Correct 11 ms 4640 KB Output is correct
14 Correct 13 ms 4772 KB Output is correct
15 Correct 11 ms 4772 KB Output is correct
16 Correct 11 ms 4772 KB Output is correct
17 Correct 13 ms 4772 KB Output is correct
18 Correct 13 ms 4772 KB Output is correct
19 Incorrect 11 ms 4772 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 4344 KB Output is correct
2 Correct 11 ms 4464 KB Output is correct
3 Correct 12 ms 4536 KB Output is correct
4 Correct 12 ms 4536 KB Output is correct
5 Correct 11 ms 4536 KB Output is correct
6 Correct 11 ms 4536 KB Output is correct
7 Correct 11 ms 4536 KB Output is correct
8 Correct 11 ms 4560 KB Output is correct
9 Correct 12 ms 4564 KB Output is correct
10 Correct 11 ms 4608 KB Output is correct
11 Correct 11 ms 4632 KB Output is correct
12 Correct 11 ms 4636 KB Output is correct
13 Correct 11 ms 4640 KB Output is correct
14 Correct 13 ms 4772 KB Output is correct
15 Correct 11 ms 4772 KB Output is correct
16 Correct 11 ms 4772 KB Output is correct
17 Correct 13 ms 4772 KB Output is correct
18 Correct 13 ms 4772 KB Output is correct
19 Incorrect 11 ms 4772 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 4344 KB Output is correct
2 Correct 11 ms 4464 KB Output is correct
3 Correct 12 ms 4536 KB Output is correct
4 Correct 12 ms 4536 KB Output is correct
5 Correct 11 ms 4536 KB Output is correct
6 Correct 11 ms 4536 KB Output is correct
7 Correct 11 ms 4536 KB Output is correct
8 Correct 11 ms 4560 KB Output is correct
9 Correct 12 ms 4564 KB Output is correct
10 Correct 11 ms 4608 KB Output is correct
11 Correct 11 ms 4632 KB Output is correct
12 Correct 11 ms 4636 KB Output is correct
13 Correct 11 ms 4640 KB Output is correct
14 Correct 13 ms 4772 KB Output is correct
15 Correct 11 ms 4772 KB Output is correct
16 Correct 11 ms 4772 KB Output is correct
17 Correct 13 ms 4772 KB Output is correct
18 Correct 13 ms 4772 KB Output is correct
19 Incorrect 11 ms 4772 KB Output isn't correct
20 Halted 0 ms 0 KB -