# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
552254 | LucaDantas | Sightseeing in Kyoto (JOI22_kyoto) | C++17 | 2081 ms | 1364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 100010;
int a[maxn], b[maxn];
int dp[maxn];
int main() {
int r, c; scanf("%d %d", &r, &c);
for(int i = 0; i < r; i++)
scanf("%d", a+i);
for(int i = 0; i < c; i++)
scanf("%d", b+i);
memset(dp, 0x3f, sizeof dp);
dp[0] = 0;
for(int i = 0; i < r; i++) {
for(int j = 1; j < c; j++)
dp[j] = min(dp[j], dp[j-1] + a[i]);
if(i == r-1) break;
for(int j = 0; j < c; j++)
dp[j] += b[j];
}
printf("%d\n", dp[c-1]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |