QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#681103 | #9447. Admired Person | Rico64 | Compile Error | / | / | C++23 | 743b | 2024-10-27 01:03:18 | 2024-10-27 01:03:19 |
Judging History
answer
#include <iostream>
using namespace std;
int main() {
int m, n;
cin >> n >> m;
long long arr[n];
long long brr[m];
for (int i = 0; i < n; ++i) cin >> arr[i];
for (int i = 0; i < m; ++i) cin >> brr[i];
sort(arr, arr + n);
sort(brr, brr + m);
long long dp[n+1][m+1];
fill(dp[0], dp[0] + (m + 1), INT64_MAX / 2);
for (int i = 0; i <= n; ++i) dp[i][0] = 0;
for (int x = 1; x <= n; ++x) {
for (int y = 1; y <= m; ++y) {
dp[x][y] = dp[x-1][y];
dp[x][y] = min(dp[x][y], dp[x-1][y-1] + abs(arr[x-1] - brr[y - 1]));
// cout << dp[x][y] << ' ';
}
// cout << endl;
}
cout << dp[n][m] << endl;
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:12:5: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 12 | sort(arr, arr + n); | ^~~~ | short answer.code:15:34: error: ‘INT64_MAX’ was not declared in this scope 15 | fill(dp[0], dp[0] + (m + 1), INT64_MAX / 2); | ^~~~~~~~~ answer.code:2:1: note: ‘INT64_MAX’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 1 | #include <iostream> +++ |+#include <cstdint> 2 |