# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
46893 | SpaimaCarpatilor | Sparklers (JOI17_sparklers) | C++17 | 36 ms | 10228 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |