QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#440067 | #362. Sparklers | ltunjic | 0 | 2ms | 5592kb | C++14 | 767b | 2024-06-13 03:50:59 | 2024-06-13 03:50:59 |
answer
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
const int N = 1010;
const int OO = 2e9 + 10;
int n, t, k, X[N];
int dp[N][N];
bool solve(int l, int r, int s) {
if(l < 0 || r >= n || X[r] - X[l] > (ll) (r - l) * t * 2 * s) { return 0; }
if(dp[l][r] != -1) { return 1; }
return dp[l][r] = solve(l - 1, r, s) | solve(l, r + 1, s);
}
int main() {
scanf("%d%d%d", &n, &k, &t);
for(int i = 0; i < n; ++i) { scanf("%d", X + i); }
int lo = -1, hi = OO;
for(int mi = (lo + hi) / 2; hi - lo > 1; mi = (lo + hi) / 2) {
memset(dp, -1, sizeof(dp)); dp[0][n - 1] = 1;
if(solve(k - 1, k - 1, mi)) { hi = mi; }
else { lo = mi; }
}
printf("%d\n", hi);
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 5592kb
input:
10 9 2 0 1117660 2284171 3390084 3568342 4222750 5180454 6186411 6360445 6519656
output:
43509
result:
wrong answer 1st lines differ - expected: '181102', found: '43509'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%