QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#48948 | #2283. Decelerating Jump | calrare | Compile Error | / | / | C | 973b | 2022-09-18 04:00:54 | 2022-09-18 04:00:54 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-09-18 04:00:54]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-09-18 04:00:54]
- 提交
answer
/*
Decelerating Jump
https://qoj.ac/problem/2283
DP
*/
#include <stdio.h>
int sqr[3005];
long long mem[3005][3005];
long long solve(int i, int maxi, int n){
/* printf("Proc %d, %d\n", i, maxi); */
long long ans = -1e15, aux;
int k;
if(mem[i][maxi] != -1e15)
ans = mem[i][maxi];
else{
if(i == n - 1)
ans = sqr[i];
else{
/* printf("Aca %d, %d\n"); */
for(k = i + 1; k <= min(n - 1, i + maxi); ++k){
aux = solve(k, k - i, n);
if(aux != -1e15){
ans = max(ans, aux + sqr[i]);
/* printf("Mejor ahora %d, %d es %lli\n", i, maxi, ans); */
}
}
}
mem[i][maxi] = ans;
/* printf("Res %d, %d, %lli\n", i, maxi, ans); */
}
return ans;
}
int main(){
int i, j, n;
long long ans;
scanf("%d", &n);
for(i = 0; i < n; ++i)
scanf("%d", sqr + i);
for(i = 0; i < n + 1; ++i)
for(j = 0; j < n + 1; ++j)
mem[i][j] = -1e15;
ans = solve(0, n - 1, n);
printf("%lli\n", ans);
return 0;
}
Details
answer.code: In function ‘solve’: answer.code:26:27: warning: implicit declaration of function ‘min’ [-Wimplicit-function-declaration] for(k = i + 1; k <= min(n - 1, i + maxi); ++k){ ^~~ answer.code:29:10: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration] ans = max(ans, aux + sqr[i]); ^~~ answer.code: In function ‘main’: answer.code:46:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^~~~~~~~~~~~~~~ answer.code:48:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", sqr + i); ^~~~~~~~~~~~~~~~~~~~ /tmp/cchYwTqB.o: In function `solve.part.0': answer.code:(.text+0x85): undefined reference to `min' answer.code:(.text+0x114): undefined reference to `max' collect2: error: ld returned 1 exit status