Submission #939762

# Submission time Handle Problem Language Result Execution time Memory
939762 2024-03-06T17:44:34 Z andrei_boaca Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
5 ms 8872 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll INF=1e17;
ll n,m;
ll lin[100005],col[100005],dp[1005][1005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>lin[i];
    for(int i=1;i<=m;i++)
        cin>>col[i];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(i!=1||j!=1)
            {
                dp[i][j]=INF;
                if(i>1)
                    dp[i][j]=min(dp[i][j],dp[i-1][j]+col[j]);
                if(j>1)
                    dp[i][j]=min(dp[i][j],dp[i][j-1]+lin[i]);
            }
    cout<<dp[n][m];
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2520 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 4700 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 2 ms 4444 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 3 ms 8796 KB Output is correct
10 Correct 4 ms 8796 KB Output is correct
11 Correct 3 ms 8872 KB Output is correct
12 Correct 5 ms 8672 KB Output is correct
13 Correct 3 ms 8792 KB Output is correct
14 Correct 3 ms 8796 KB Output is correct
15 Correct 3 ms 8796 KB Output is correct
16 Correct 3 ms 8672 KB Output is correct
17 Correct 4 ms 8796 KB Output is correct
18 Correct 1 ms 2516 KB Output is correct
19 Correct 1 ms 2516 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2600 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2512 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2524 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2548 KB Output is correct
3 Incorrect 2 ms 6748 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2520 KB Output is correct
3 Correct 1 ms 2516 KB Output is correct
4 Correct 1 ms 4700 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 2 ms 4444 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 3 ms 8796 KB Output is correct
10 Correct 4 ms 8796 KB Output is correct
11 Correct 3 ms 8872 KB Output is correct
12 Correct 5 ms 8672 KB Output is correct
13 Correct 3 ms 8792 KB Output is correct
14 Correct 3 ms 8796 KB Output is correct
15 Correct 3 ms 8796 KB Output is correct
16 Correct 3 ms 8672 KB Output is correct
17 Correct 4 ms 8796 KB Output is correct
18 Correct 1 ms 2516 KB Output is correct
19 Correct 1 ms 2516 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2600 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2512 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2524 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2392 KB Output is correct
30 Correct 1 ms 2548 KB Output is correct
31 Incorrect 2 ms 6748 KB Output isn't correct
32 Halted 0 ms 0 KB -