Submission #552254

# Submission time Handle Problem Language Result Execution time Memory
552254 2022-04-22T23:20:43 Z LucaDantas Sightseeing in Kyoto (JOI22_kyoto) C++17
0 / 100
2000 ms 1364 KB
#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

kyoto.cpp: In function 'int main()':
kyoto.cpp:14:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  int r, c; scanf("%d %d", &r, &c);
      |            ~~~~~^~~~~~~~~~~~~~~~~
kyoto.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d", a+i);
      |   ~~~~~^~~~~~~~~~~
kyoto.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d", b+i);
      |   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 498 ms 996 KB Output is correct
5 Correct 15 ms 980 KB Output is correct
6 Correct 4 ms 724 KB Output is correct
7 Execution timed out 2081 ms 1364 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Incorrect 1 ms 596 KB Output isn't correct
4 Halted 0 ms 0 KB -