QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149597 | #2785. Boxes with souvenirs | AbdelmagedNour# | Compile Error | / | / | C++20 | 559b | 2023-08-24 22:39:04 | 2024-07-04 01:51:30 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 01:51:30]
- 管理员手动重测该提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-24 22:39:05]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-24 22:39:04]
- 提交
answer
#include <vector>
#include <cmath>
#include "algorithm"
#include "numeric"
using namespace std;
//#include "grader.cpp"
#include "boxes.h"
long long delivery(int N, int K, int L, int p[]){
vector<long long>pre(K+1),suf(K+1);
long long res=LLONG_MAX;
for(int i=K-1;i<N;i++)suf[i%K]+=L-p[i];
for(int i=K-1;i<N;i++){
int l=p[i-K+1],r=p[i];
suf[i%K]-=L-p[i];
if(i>=K)pre[i%K]+=p[i-K];
int cost=min({L,2*r,2*(L-l)});
res=min(res,cost+2*pre[i%K]+2*suf[(i+1)%K]);
}
return res;
}
详细
answer.code: In function ‘long long int delivery(int, int, int, int*)’: answer.code:11:19: error: ‘LLONG_MAX’ was not declared in this scope 11 | long long res=LLONG_MAX; | ^~~~~~~~~ answer.code:8:1: note: ‘LLONG_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’? 7 | #include "boxes.h" +++ |+#include <climits> 8 |