Submission #123355

# Submission time Handle Problem Language Result Execution time Memory
123355 2019-07-01T08:16:20 Z 임유진(#3021) Two Dishes (JOI19_dishes) C++14
10 / 100
41 ms 31992 KB
#include<stdio.h>
#include<algorithm>

using namespace std;

#define MAXN 2005

typedef long long lint;

lint A[MAXN], S[MAXN], P[MAXN], B[MAXN], T[MAXN], Q[MAXN];
lint dp[MAXN][MAXN];
lint suma[MAXN], sumb[MAXN];

int main() {
	lint N, M;

	scanf("%lld%lld", &N, &M);
	for(int i = 1; i <= N; i++) scanf("%lld%lld%lld", A+i, S+i, P+i);
	for(int i = 1; i <= M; i++) scanf("%lld%lld%lld", B+i, T+i, Q+i);

	for(int i = 1; i <= N; i++) suma[i] = suma[i-1] + A[i];
	for(int i = 1; i <= M; i++) sumb[i] = sumb[i-1] + B[i];

	for(int i = 0; i <= N; i++) for(int j = 0; j <= M; j++) {
		dp[i][j] = 0;
		if(i > 0) dp[i][j] = dp[i-1][j] + (S[i] >= suma[i] + sumb[j] ? 1 : 0);
		if(j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1] + (T[j] >= suma[i] + sumb[j] ? 1 : 0));
	}

	printf("%lld", dp[N][M]);
	return 0;
}

Compilation message

dishes.cpp: In function 'int main()':
dishes.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
dishes.cpp:18:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= N; i++) scanf("%lld%lld%lld", A+i, S+i, P+i);
                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dishes.cpp:19:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= M; i++) scanf("%lld%lld%lld", B+i, T+i, Q+i);
                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 41 ms 31864 KB Output is correct
18 Correct 40 ms 31900 KB Output is correct
19 Correct 41 ms 31992 KB Output is correct
20 Correct 40 ms 31864 KB Output is correct
21 Correct 39 ms 30840 KB Output is correct
22 Correct 39 ms 31864 KB Output is correct
23 Correct 40 ms 31908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 41 ms 31864 KB Output is correct
18 Correct 40 ms 31900 KB Output is correct
19 Correct 41 ms 31992 KB Output is correct
20 Correct 40 ms 31864 KB Output is correct
21 Correct 39 ms 30840 KB Output is correct
22 Correct 39 ms 31864 KB Output is correct
23 Correct 40 ms 31908 KB Output is correct
24 Execution timed out 3 ms 504 KB Time limit exceeded (wall clock)
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 41 ms 31864 KB Output is correct
18 Correct 40 ms 31900 KB Output is correct
19 Correct 41 ms 31992 KB Output is correct
20 Correct 40 ms 31864 KB Output is correct
21 Correct 39 ms 30840 KB Output is correct
22 Correct 39 ms 31864 KB Output is correct
23 Correct 40 ms 31908 KB Output is correct
24 Execution timed out 3 ms 504 KB Time limit exceeded (wall clock)
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 41 ms 31864 KB Output is correct
18 Correct 40 ms 31900 KB Output is correct
19 Correct 41 ms 31992 KB Output is correct
20 Correct 40 ms 31864 KB Output is correct
21 Correct 39 ms 30840 KB Output is correct
22 Correct 39 ms 31864 KB Output is correct
23 Correct 40 ms 31908 KB Output is correct
24 Execution timed out 3 ms 504 KB Time limit exceeded (wall clock)
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -