QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#753964 | #6606. The Boomsday Project | SGColin# | WA | 259ms | 7368kb | C++14 | 1.2kb | 2024-11-16 13:57:24 | 2024-11-16 13:57:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
inline ll rd() {
ll x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
constexpr int M = 507;
constexpr int N = 300007;
ll f[N];
int d[M], k[M], c[M], a[N], ptr[M];
int main() {
memset(f, 0x3f, sizeof(f));
int m = rd(), t = rd();
d[0] = 1; k[0] = 1; c[0] = rd();
rep(i, 1, m) {d[i] = rd(); k[i] = rd(); c[i] = rd();}
int n = 0;
rep(i, 1, t) {
int x = rd(), cnt = rd();
rep(j, 1, cnt) a[++n] = x;
}
f[0] = 0;
rep(i, 0, m) ptr[i] = 1;
rep(i, 1, n) {
rep(j, 0, m) {
while (i - ptr[j] + 1 > k[j] || a[i] - a[ptr[j]] + 1 > d[j]) ++ptr[j];
f[i] = min(f[i], f[ptr[j] - 1] + c[j]);
}
}
printf("%lld\n", f[n]);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 6188kb
input:
2 1 10 1 3 12 1 2 9 1 10
output:
42
result:
ok 1 number(s): "42"
Test #2:
score: 0
Accepted
time: 1ms
memory: 6172kb
input:
2 4 10 1 3 12 1 2 9 1 3 2 3 3 3 4 1
output:
45
result:
ok 1 number(s): "45"
Test #3:
score: -100
Wrong Answer
time: 259ms
memory: 7368kb
input:
500 100 1000 95 20 20892 73 627 55354 52 747 1404314 19 676 597007 65 814 1569851 91 397 691575 81 4 4575 97 382 624404 21 197 201850 67 799 643576 27 895 1510533 3 800 552439 49 954 1149851 70 892 676406 82 882 1348956 1 318 324094 43 238 439111 94 397 471003 16 119 130686 1 637 77731 79 292 35234 ...
output:
451888
result:
wrong answer 1st numbers differ - expected: '450790', found: '451888'