Submission #426308

# Submission time Handle Problem Language Result Execution time Memory
426308 2021-06-13T17:19:25 Z Apiram Jelly Flavours (IOI20_jelly) C++14
9 / 100
1540 ms 2097156 KB
#include "jelly.h"
#include <cstdio>
#include <cassert>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
int find_maximum_unique(int x, int y, std::vector<int> arr, std::vector<int> brr) {
	int n = arr.size();
	bool ok=true;
	for (int i =0;i<n;++i){
		if (arr[i]!=brr[i]){
			ok=false;break;
		}
	}
	if (!ok){
	int dp [n+1][x+1][y+1];
	memset(dp,0,sizeof dp);
	for (int i =1;i<=n;++i){
		for (int j =0;j<=x;++j){
			for (int k =0;k<=y;++k){
				dp[i][j][k] = max({(j-arr[i-1]>=0)?dp[i-1][j-arr[i-1]][k]+1:0,(k-brr[i-1]>=0)?dp[i-1][j][k-brr[i-1]]+1:0,dp[i-1][j][k],dp[i][j][k]});
			}
		}
	}
	return dp[n][x][y];}
	else {
		int ans=0,ans2=0;
		for (int i =0;i<n;++i){
			if (x-arr[i]<y-brr[i]){
				y-=brr[i];
				ans++;
			}
			else {
				x-=arr[i];
				ans++;
			}
		}
		return ans;
	}

}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:27:13: warning: unused variable 'ans2' [-Wunused-variable]
   27 |   int ans=0,ans2=0;
      |             ^~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1740 KB Output is correct
2 Correct 9 ms 7712 KB Output is correct
3 Correct 12 ms 8008 KB Output is correct
4 Correct 19 ms 10956 KB Output is correct
5 Correct 13 ms 8560 KB Output is correct
6 Correct 8 ms 6860 KB Output is correct
7 Correct 12 ms 9620 KB Output is correct
8 Correct 8 ms 6808 KB Output is correct
9 Correct 11 ms 8908 KB Output is correct
10 Correct 15 ms 10712 KB Output is correct
11 Correct 2 ms 1100 KB Output is correct
12 Correct 2 ms 1740 KB Output is correct
13 Correct 9 ms 7628 KB Output is correct
14 Correct 12 ms 7884 KB Output is correct
15 Correct 16 ms 11040 KB Output is correct
16 Correct 11 ms 8524 KB Output is correct
17 Correct 8 ms 6860 KB Output is correct
18 Correct 15 ms 9688 KB Output is correct
19 Correct 8 ms 6732 KB Output is correct
20 Correct 12 ms 8948 KB Output is correct
21 Correct 2 ms 1996 KB Output is correct
22 Correct 13 ms 10700 KB Output is correct
23 Correct 3 ms 1996 KB Output is correct
24 Incorrect 1 ms 288 KB 1st lines differ - on the 1st token, expected: '0', found: '8'
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1740 KB Output is correct
2 Correct 9 ms 7712 KB Output is correct
3 Correct 12 ms 8008 KB Output is correct
4 Correct 19 ms 10956 KB Output is correct
5 Correct 13 ms 8560 KB Output is correct
6 Correct 8 ms 6860 KB Output is correct
7 Correct 12 ms 9620 KB Output is correct
8 Correct 8 ms 6808 KB Output is correct
9 Correct 11 ms 8908 KB Output is correct
10 Correct 15 ms 10712 KB Output is correct
11 Correct 2 ms 1100 KB Output is correct
12 Correct 2 ms 1740 KB Output is correct
13 Correct 9 ms 7628 KB Output is correct
14 Correct 12 ms 7884 KB Output is correct
15 Correct 16 ms 11040 KB Output is correct
16 Correct 11 ms 8524 KB Output is correct
17 Correct 8 ms 6860 KB Output is correct
18 Correct 15 ms 9688 KB Output is correct
19 Correct 8 ms 6732 KB Output is correct
20 Correct 12 ms 8948 KB Output is correct
21 Correct 2 ms 1996 KB Output is correct
22 Correct 13 ms 10700 KB Output is correct
23 Correct 3 ms 1996 KB Output is correct
24 Incorrect 1 ms 288 KB 1st lines differ - on the 1st token, expected: '0', found: '8'
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 13280 KB Output is correct
2 Correct 41 ms 20536 KB Output is correct
3 Correct 11 ms 5624 KB Output is correct
4 Correct 17 ms 8140 KB Output is correct
5 Correct 118 ms 53568 KB Output is correct
6 Correct 144 ms 67972 KB Output is correct
7 Correct 134 ms 65740 KB Output is correct
8 Correct 31 ms 12896 KB Output is correct
9 Correct 147 ms 69904 KB Output is correct
10 Correct 66 ms 28620 KB Output is correct
11 Correct 122 ms 61332 KB Output is correct
12 Correct 98 ms 48328 KB Output is correct
13 Correct 81 ms 42188 KB Output is correct
14 Correct 28 ms 13592 KB Output is correct
15 Correct 102 ms 48588 KB Output is correct
16 Correct 89 ms 46304 KB Output is correct
17 Correct 106 ms 48964 KB Output is correct
18 Correct 105 ms 52576 KB Output is correct
19 Correct 84 ms 41580 KB Output is correct
20 Correct 29 ms 13388 KB Output is correct
21 Correct 27 ms 13316 KB Output is correct
22 Correct 41 ms 20428 KB Output is correct
23 Correct 11 ms 5548 KB Output is correct
24 Correct 17 ms 8140 KB Output is correct
25 Correct 113 ms 53572 KB Output is correct
26 Correct 143 ms 68044 KB Output is correct
27 Correct 131 ms 65840 KB Output is correct
28 Correct 25 ms 12836 KB Output is correct
29 Correct 156 ms 69848 KB Output is correct
30 Correct 60 ms 28656 KB Output is correct
31 Correct 119 ms 61380 KB Output is correct
32 Correct 96 ms 48332 KB Output is correct
33 Correct 86 ms 42188 KB Output is correct
34 Correct 28 ms 13516 KB Output is correct
35 Correct 100 ms 48664 KB Output is correct
36 Correct 94 ms 46316 KB Output is correct
37 Correct 96 ms 48932 KB Output is correct
38 Correct 105 ms 52680 KB Output is correct
39 Correct 85 ms 41628 KB Output is correct
40 Correct 28 ms 13404 KB Output is correct
41 Correct 26 ms 13260 KB Output is correct
42 Correct 40 ms 20504 KB Output is correct
43 Correct 11 ms 5628 KB Output is correct
44 Correct 17 ms 8140 KB Output is correct
45 Correct 114 ms 53648 KB Output is correct
46 Correct 134 ms 68164 KB Output is correct
47 Correct 126 ms 65732 KB Output is correct
48 Correct 25 ms 12924 KB Output is correct
49 Correct 152 ms 69784 KB Output is correct
50 Correct 59 ms 28740 KB Output is correct
51 Correct 117 ms 61340 KB Output is correct
52 Correct 93 ms 48300 KB Output is correct
53 Correct 84 ms 42188 KB Output is correct
54 Correct 27 ms 13476 KB Output is correct
55 Correct 99 ms 48588 KB Output is correct
56 Correct 93 ms 46404 KB Output is correct
57 Correct 98 ms 49004 KB Output is correct
58 Correct 101 ms 52548 KB Output is correct
59 Correct 88 ms 41664 KB Output is correct
60 Correct 28 ms 13388 KB Output is correct
61 Correct 25 ms 13260 KB Output is correct
62 Correct 39 ms 20536 KB Output is correct
63 Correct 11 ms 5580 KB Output is correct
64 Correct 18 ms 8244 KB Output is correct
65 Correct 108 ms 53596 KB Output is correct
66 Correct 133 ms 68048 KB Output is correct
67 Correct 125 ms 65844 KB Output is correct
68 Correct 25 ms 12876 KB Output is correct
69 Correct 143 ms 69960 KB Output is correct
70 Correct 60 ms 28720 KB Output is correct
71 Correct 119 ms 61292 KB Output is correct
72 Correct 95 ms 48248 KB Output is correct
73 Correct 82 ms 42188 KB Output is correct
74 Correct 28 ms 13516 KB Output is correct
75 Correct 102 ms 48676 KB Output is correct
76 Correct 88 ms 46284 KB Output is correct
77 Correct 94 ms 49036 KB Output is correct
78 Correct 106 ms 52608 KB Output is correct
79 Correct 87 ms 41620 KB Output is correct
80 Correct 30 ms 13432 KB Output is correct
81 Correct 26 ms 13260 KB Output is correct
82 Correct 39 ms 20532 KB Output is correct
83 Correct 12 ms 5628 KB Output is correct
84 Correct 17 ms 8140 KB Output is correct
85 Correct 110 ms 53604 KB Output is correct
86 Correct 134 ms 67992 KB Output is correct
87 Correct 134 ms 65732 KB Output is correct
88 Correct 28 ms 12876 KB Output is correct
89 Correct 155 ms 69900 KB Output is correct
90 Correct 61 ms 28708 KB Output is correct
91 Correct 123 ms 61288 KB Output is correct
92 Correct 96 ms 48308 KB Output is correct
93 Correct 82 ms 42188 KB Output is correct
94 Correct 27 ms 13516 KB Output is correct
95 Correct 101 ms 48612 KB Output is correct
96 Correct 96 ms 46284 KB Output is correct
97 Correct 96 ms 49032 KB Output is correct
98 Correct 101 ms 52684 KB Output is correct
99 Correct 84 ms 41548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1540 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 1st lines differ - on the 1st token, expected: '154', found: '1959'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1740 KB Output is correct
2 Correct 9 ms 7712 KB Output is correct
3 Correct 12 ms 8008 KB Output is correct
4 Correct 19 ms 10956 KB Output is correct
5 Correct 13 ms 8560 KB Output is correct
6 Correct 8 ms 6860 KB Output is correct
7 Correct 12 ms 9620 KB Output is correct
8 Correct 8 ms 6808 KB Output is correct
9 Correct 11 ms 8908 KB Output is correct
10 Correct 15 ms 10712 KB Output is correct
11 Correct 2 ms 1100 KB Output is correct
12 Correct 2 ms 1740 KB Output is correct
13 Correct 9 ms 7628 KB Output is correct
14 Correct 12 ms 7884 KB Output is correct
15 Correct 16 ms 11040 KB Output is correct
16 Correct 11 ms 8524 KB Output is correct
17 Correct 8 ms 6860 KB Output is correct
18 Correct 15 ms 9688 KB Output is correct
19 Correct 8 ms 6732 KB Output is correct
20 Correct 12 ms 8948 KB Output is correct
21 Correct 2 ms 1996 KB Output is correct
22 Correct 13 ms 10700 KB Output is correct
23 Correct 3 ms 1996 KB Output is correct
24 Incorrect 1 ms 288 KB 1st lines differ - on the 1st token, expected: '0', found: '8'
25 Halted 0 ms 0 KB -