Submission #567169

# Submission time Handle Problem Language Result Execution time Memory
567169 2022-05-23T08:45:00 Z dantoh000 Sightseeing in Kyoto (JOI22_kyoto) C++14
10 / 100
15 ms 8312 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
int n,m;
int a[1005], b[1005];
int mem[1005][1005];
int dp(int x, int y){
    if (x == n-1 && y == m-1) return 0;
    if (mem[x][y] != -1) return mem[x][y];
    int ret = INF;
    if (x != n-1) ret = min(ret, dp(x+1, y) + b[y]);
    if (y != m-1) ret = min(ret, dp(x, y+1) + a[x]);
    //printf("%lld %lld %lld %lld %lld\n",x,y,ret,a[x],b[y]);
    return mem[x][y] = ret;
}
main(){
    scanf("%lld%lld",&n,&m);
    for (int i = 0; i < n; i++){
        scanf("%lld",&a[i]);
    }
    for (int j = 0; j < m; j++){
        scanf("%lld",&b[j]);
    }
    memset(mem,-1,sizeof(mem));
    printf("%lld",dp(0,0));

}

Compilation message

kyoto.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
kyoto.cpp: In function 'int main()':
kyoto.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%lld%lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
kyoto.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
kyoto.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%lld",&b[j]);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Output is correct
2 Correct 4 ms 8148 KB Output is correct
3 Correct 3 ms 8148 KB Output is correct
4 Correct 4 ms 8256 KB Output is correct
5 Correct 3 ms 8148 KB Output is correct
6 Correct 3 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 4 ms 8148 KB Output is correct
9 Correct 13 ms 8308 KB Output is correct
10 Correct 12 ms 8308 KB Output is correct
11 Correct 13 ms 8276 KB Output is correct
12 Correct 14 ms 8276 KB Output is correct
13 Correct 14 ms 8276 KB Output is correct
14 Correct 15 ms 8276 KB Output is correct
15 Correct 14 ms 8308 KB Output is correct
16 Correct 13 ms 8308 KB Output is correct
17 Correct 15 ms 8312 KB Output is correct
18 Correct 3 ms 8148 KB Output is correct
19 Correct 3 ms 8160 KB Output is correct
20 Correct 3 ms 8148 KB Output is correct
21 Correct 4 ms 8148 KB Output is correct
22 Correct 4 ms 8152 KB Output is correct
23 Correct 3 ms 8148 KB Output is correct
24 Correct 5 ms 8148 KB Output is correct
25 Correct 4 ms 8148 KB Output is correct
26 Correct 4 ms 8148 KB Output is correct
27 Correct 5 ms 8172 KB Output is correct
28 Correct 4 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8148 KB Output is correct
2 Correct 4 ms 8148 KB Output is correct
3 Incorrect 6 ms 8284 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Output is correct
2 Correct 4 ms 8148 KB Output is correct
3 Correct 3 ms 8148 KB Output is correct
4 Correct 4 ms 8256 KB Output is correct
5 Correct 3 ms 8148 KB Output is correct
6 Correct 3 ms 8148 KB Output is correct
7 Correct 5 ms 8148 KB Output is correct
8 Correct 4 ms 8148 KB Output is correct
9 Correct 13 ms 8308 KB Output is correct
10 Correct 12 ms 8308 KB Output is correct
11 Correct 13 ms 8276 KB Output is correct
12 Correct 14 ms 8276 KB Output is correct
13 Correct 14 ms 8276 KB Output is correct
14 Correct 15 ms 8276 KB Output is correct
15 Correct 14 ms 8308 KB Output is correct
16 Correct 13 ms 8308 KB Output is correct
17 Correct 15 ms 8312 KB Output is correct
18 Correct 3 ms 8148 KB Output is correct
19 Correct 3 ms 8160 KB Output is correct
20 Correct 3 ms 8148 KB Output is correct
21 Correct 4 ms 8148 KB Output is correct
22 Correct 4 ms 8152 KB Output is correct
23 Correct 3 ms 8148 KB Output is correct
24 Correct 5 ms 8148 KB Output is correct
25 Correct 4 ms 8148 KB Output is correct
26 Correct 4 ms 8148 KB Output is correct
27 Correct 5 ms 8172 KB Output is correct
28 Correct 4 ms 8148 KB Output is correct
29 Correct 3 ms 8148 KB Output is correct
30 Correct 4 ms 8148 KB Output is correct
31 Incorrect 6 ms 8284 KB Output isn't correct
32 Halted 0 ms 0 KB -