QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#166584 | #149. Peru | a_z_c | Compile Error | / | / | C++14 | 736b | 2023-09-06 15:18:26 | 2024-09-10 16:44:06 |
Judging History
你现在查看的是最新测评结果
- [2024-09-10 16:44:06]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-06 15:18:53]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-06 15:18:26]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2010;
const int mod = 1e9 + 7;
int s[maxn];
int mx[maxn][maxn];
int f[maxn];
int n, k;
int ans = 0, pw = 1;
int type, seed;
signed main() {
scanf("%lld%lld", &n, &k);
for(int i = 1; i <= n; i++) {
scanf("%lld", &s[i]);
mx[i][i] = s[i];
}
for(int i = 1; i <= n; i++) {
for(int j = i + 1; j <= n; j++) {
mx[i][j] = max(mx[i][j - 1], s[j]);
}
}
for(int i = 1; i <= n; i++) {
f[i] = INT64_MAX;
for(int j = max(0ll, i - k); j < i; j++) {
f[i] = min(f[i], f[j] + mx[j + 1][i]);
}
}
for(int i = n; i; i--, pw = 23 * pw % mod) {
ans = (ans + 1ll * f[i] * pw % mod) % mod;
}
printf("%lld", ans);
}
详细
implementer.cpp: In function ‘char nextch()’: implementer.cpp:15:31: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | if (pos == BUF_SIZE) fread(buf, BUF_SIZE, 1, fin), pos = 0; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%lld%lld", &n, &k); | ~~~~~^~~~~~~~~~~~~~~~~~~~ answer.code:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%lld", &s[i]); | ~~~~~^~~~~~~~~~~~~~~ /usr/bin/ld: /tmp/ccNrCBmE.o: in function `main': answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccO2EddC.o:implementer.cpp:(.text.startup+0x0): first defined here /usr/bin/ld: /tmp/ccO2EddC.o: in function `main': implementer.cpp:(.text.startup+0x151): undefined reference to `solve(int, int, int*)' collect2: error: ld returned 1 exit status