QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#149601 | #2785. Boxes with souvenirs | AbdelmagedNour# | 0 | 0ms | 0kb | C++20 | 613b | 2023-08-24 22:44:14 | 2024-07-04 01:51:30 |
answer
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
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=N-1;i>=0;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]);
}
if(N<=K)res=min(res,1LL*L);
return res;
}
详细
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
1 1 1000000000 210758687
output:
Unauthorized output
result:
Subtask #2:
score: 0
Runtime Error
Test #8:
score: 0
Runtime Error
input:
1000 1000 1000 0 0 1 2 3 3 4 5 5 6 6 7 8 8 8 9 10 11 11 11 12 13 13 13 14 14 15 16 17 17 17 18 20 20 21 21 24 25 25 26 30 31 34 34 35 38 40 43 44 46 46 46 47 47 51 52 52 52 55 56 58 62 64 65 67 68 69 72 73 75 76 77 78 79 79 80 83 84 85 85 86 86 87 88 88 88 92 92 92 95 95 96 98 98 99 99 100 100 101 1...
output:
Unauthorized output
result:
Subtask #3:
score: 0
Runtime Error
Test #15:
score: 0
Runtime Error
input:
10 5 5 0 0 0 0 0 1 3 3 3 4
output:
Unauthorized output
result:
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%