Submission #552251

#TimeUsernameProblemLanguageResultExecution timeMemory
552251LucaDantasSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
6 ms332 KiB
// so o brutao pra nao ficar zerado ja que era bem facil codar isso #include <bits/stdc++.h> using namespace std; constexpr int maxn = 1010; int a[maxn], b[maxn]; long long 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("%lld\n", dp[c-1]); }

Compilation message (stderr)

kyoto.cpp: In function 'int main()':
kyoto.cpp:11:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  int r, c; scanf("%d %d", &r, &c);
      |            ~~~~~^~~~~~~~~~~~~~~~~
kyoto.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", a+i);
      |   ~~~~~^~~~~~~~~~~
kyoto.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", b+i);
      |   ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...