Submission #1205945

#TimeUsernameProblemLanguageResultExecution timeMemory
1205945salmonSightseeing in Kyoto (JOI22_kyoto)C++20
10 / 100
18 ms35084 KiB
#include <bits/stdc++.h> using namespace std; int H; int W; int lst[1100]; int lst1[1100]; vector<pair<int,int>> adjlst[1100100]; long long int memo[1100][1100]; long long int inf = 1.1e18; int main(){ scanf(" %d",&H); scanf(" %d",&W); for(int i = 0; i < H; i++) scanf(" %d",&lst[i]); for(int i = 0; i < W; i++) scanf(" %d",&lst1[i]); memo[0][0] = 0; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ if(i == 0 && j == 0) continue; memo[i][j] = inf; if(i != 0){ memo[i][j] = min(memo[i][j], memo[i - 1][j] + lst1[j]); } if(j != 0){ memo[i][j] = min(memo[i][j], memo[i][j - 1] + lst[i]); } } } printf("%lld\n",memo[H-1][W-1]); }

Compilation message (stderr)

kyoto.cpp: In function 'int main()':
kyoto.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf(" %d",&H);
      |         ~~~~~^~~~~~~~~~
kyoto.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf(" %d",&W);
      |         ~~~~~^~~~~~~~~~
kyoto.cpp:17:41: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         for(int i = 0; i < H; i++) scanf(" %d",&lst[i]);
      |                                    ~~~~~^~~~~~~~~~~~~~~
kyoto.cpp:18:41: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         for(int i = 0; i < W; i++) scanf(" %d",&lst1[i]);
      |                                    ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...