QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#847220 | #9987. 骑行计划 | hcywoi | WA | 65ms | 6620kb | C++23 | 992b | 2025-01-07 19:08:02 | 2025-01-07 19:08:03 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
constexpr int inf = 1E9;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m, c;
std::cin >> n >> m >> c;
std::vector<int> s(n);
for (int i = 0; i < n; i++) {
std::cin >> s[i];
}
std::vector<int> w(m), d(m), t(m);
for (int i = 0; i < m; i++) {
std::cin >> w[i] >> d[i] >> t[i];
}
std::vector<int> f(n + 1, inf);
f[n] = 0;
for (int l = n - 1; l >= 0; l--) {
std::vector sum(m, std::vector<int>(n));
for (int i = 0; i < m; i++) {
for (int r = l; r < l + d[i] && r < n; r++) {
sum[i][r] = (l == r ? 0 : sum[i][r - 1]) + std::max(0, s[r] - t[i]) * c;
}
}
f[l] = f[l + 1] + s[l] * c;
for (int i = 0; i < m; i++) {
for (int j = 1; j <= d[i] && l + j <= n; j++) {
f[l] = std::min(f[l], f[l + j] + sum[i][l + j - 1] + w[i]);
}
}
}
std::cout << f[0] << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 47ms
memory: 5160kb
input:
85 5408 4856 52 43 38 21 33 28 24 46 4 66 14 51 63 24 69 35 50 9 63 58 43 69 1 28 59 56 50 63 12 23 41 6 19 9 41 45 14 52 6 7 1 24 30 9 33 54 71 38 55 28 61 10 21 13 22 56 29 24 19 27 9 3 25 54 45 50 9 42 13 5 32 37 56 51 24 3 12 37 68 29 69 40 53 50 69 486593 41 10 175445 13 5 1271250 9 35 7064 1 2...
output:
1440909
result:
ok single line: '1440909'
Test #2:
score: 0
Accepted
time: 24ms
memory: 4084kb
input:
149 1277 4355 43 52 37 18 41 38 5 57 33 37 50 51 60 31 57 64 16 15 16 51 40 65 52 71 45 24 47 74 4 64 53 37 4 73 10 35 51 49 18 21 28 2 45 29 46 50 73 17 11 66 12 6 58 56 23 67 41 64 23 71 70 72 25 7 15 58 63 58 46 51 70 65 34 65 60 17 37 2 62 53 17 74 34 18 19 3 16 21 67 43 65 64 44 14 54 71 54 65 ...
output:
2479892
result:
ok single line: '2479892'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
128 135 4945 20 16 3 30 17 19 18 25 7 25 1 23 18 19 29 13 13 23 30 2 25 28 7 8 19 2 31 30 22 7 7 16 26 31 15 20 3 20 29 15 26 4 23 29 19 13 7 7 24 12 11 24 8 2 5 2 18 21 25 1 5 31 22 22 23 13 19 20 23 19 10 20 14 12 23 8 18 31 14 12 25 27 5 18 27 12 5 26 22 3 13 23 16 11 29 4 22 3 9 29 26 29 13 10 2...
output:
1986485
result:
ok single line: '1986485'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
36 581 2377 52 79 10 73 39 70 65 43 76 81 32 54 45 45 28 56 34 35 38 16 56 78 56 39 19 4 57 11 8 31 69 53 69 73 49 58 475218 7 48 140593 4 21 6733 3 1 281348 5 27 14745 7 10 103948 6 9 21841 3 26 560211 5 71 5291 1 3 711 1 3 9948 1 15 2894 2 1 34177 1 25 187269 14 8 442896 9 22 252252 7 43 401946 13...
output:
434045
result:
ok single line: '434045'
Test #5:
score: 0
Accepted
time: 31ms
memory: 3984kb
input:
142 1462 6716 20 30 35 17 36 1 8 15 9 37 10 1 39 18 6 2 28 36 28 37 7 2 35 15 39 37 37 30 23 12 28 4 2 2 29 10 18 9 24 31 7 21 25 36 21 17 31 20 17 30 7 39 3 10 37 32 16 23 21 19 33 18 20 37 11 29 18 12 29 28 22 27 4 12 24 6 2 32 19 2 39 9 11 18 37 10 7 3 19 3 30 6 7 36 9 14 6 8 19 33 11 30 29 13 9 ...
output:
1463622
result:
ok single line: '1463622'
Test #6:
score: 0
Accepted
time: 65ms
memory: 6620kb
input:
95 7993 2085 5 24 3 23 29 10 30 3 2 29 10 22 25 25 1 15 13 10 9 32 29 29 17 21 8 27 22 26 19 6 3 28 26 5 19 11 27 13 18 23 27 30 8 6 9 2 33 18 29 4 20 27 16 7 1 11 10 21 13 8 27 6 10 3 19 25 29 33 32 4 23 14 22 6 16 8 9 19 18 2 24 24 5 13 32 33 17 27 28 24 5 31 27 24 14 90658 7 7 17303 11 1 118486 4...
output:
241704
result:
ok single line: '241704'
Test #7:
score: 0
Accepted
time: 22ms
memory: 4508kb
input:
41 6420 2466 59 27 59 46 72 65 44 29 94 40 9 27 89 68 56 92 17 86 83 14 11 65 6 37 93 36 58 79 6 13 12 54 63 58 44 25 83 74 38 18 41 83339 1 85 36883 3 31 162666 2 57 34382 6 5 303388 17 23 4074 2 1 508895 4 67 14436 2 58 7798 3 3 25055 1 15 27194 3 5 366 1 1 4453 2 3 77937 1 56 1285 1 1 116054 2 37...
output:
350353
result:
ok single line: '350353'
Test #8:
score: -100
Wrong Answer
time: 2ms
memory: 3832kb
input:
129 113 1675 72 64 57 113 57 94 119 127 128 89 1 82 54 107 113 69 104 125 39 2 2 119 122 45 31 122 114 40 35 46 126 47 110 39 2 6 41 22 19 16 103 47 52 59 34 83 93 45 117 119 118 6 88 71 31 43 8 107 28 12 46 92 12 120 34 53 91 39 78 85 111 4 97 20 64 5 41 42 86 40 68 43 86 38 56 87 55 15 120 107 95 ...
output:
3861689
result:
wrong answer 1st lines differ - expected: '3856152', found: '3861689'