답안 #476400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
476400 2021-09-26T10:20:56 Z starplat Jelly Flavours (IOI20_jelly) C++14
33 / 100
82 ms 1228 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
pair<int,int> v[2005],dp[100005];
pair<int,int> cmp(pair<int,int> a,pair<int,int> b)
{
	if (a.f==-1) return b;
	if (a.f<b.f) return b;
	if (a.f==b.f&&a.s>b.s) return b;
	return a;
}
int find_maximum_unique(int x,int y,vector<int> a, vector<int> b)
{
	int n=a.size();
	int ans=0;
	pair<int,int> v[2005],dp[100005];
	for (int i=1;i<=n;i++){
		v[i]={a[i-1],b[i-1]};
	}
	for (int i=1;i<=x;i++) dp[i]={-1,-1};
	dp[1]={0,0};
	sort(v+1,v+1+n);
	for (int i=1;i<=n;i++){
		for (int j=x;j>=0;j--){
			if (dp[j].f==-1) continue;
			if (j+v[i].f<=x){
				dp[j+v[i].f]=cmp(dp[j+v[i].f],{dp[j].f+1,dp[j].s});
			}
			if (dp[j].s+v[i].s<=y){
				dp[j]=cmp(dp[j],{dp[j].f+1,dp[j].s+v[i].s});
			}
		}
	}
	for (int i=0;i<=x;i++){
		if (dp[i].f!=-1&&dp[i].s<=y) ans=max(dp[i].f,ans);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1100 KB Output is correct
2 Correct 1 ms 1100 KB Output is correct
3 Correct 1 ms 1100 KB Output is correct
4 Correct 1 ms 1076 KB Output is correct
5 Correct 1 ms 1072 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 1 ms 1100 KB Output is correct
8 Incorrect 1 ms 1100 KB 1st lines differ - on the 1st token, expected: '5', found: '4'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1100 KB Output is correct
2 Correct 1 ms 1100 KB Output is correct
3 Correct 1 ms 1100 KB Output is correct
4 Correct 1 ms 1076 KB Output is correct
5 Correct 1 ms 1072 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 1 ms 1100 KB Output is correct
8 Incorrect 1 ms 1100 KB 1st lines differ - on the 1st token, expected: '5', found: '4'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1100 KB Output is correct
2 Correct 16 ms 1148 KB Output is correct
3 Correct 5 ms 1100 KB Output is correct
4 Correct 8 ms 1100 KB Output is correct
5 Correct 43 ms 1100 KB Output is correct
6 Correct 51 ms 1100 KB Output is correct
7 Correct 51 ms 1100 KB Output is correct
8 Correct 11 ms 1100 KB Output is correct
9 Correct 51 ms 1132 KB Output is correct
10 Correct 20 ms 1124 KB Output is correct
11 Correct 56 ms 1116 KB Output is correct
12 Correct 38 ms 1116 KB Output is correct
13 Correct 33 ms 1100 KB Output is correct
14 Correct 12 ms 1100 KB Output is correct
15 Correct 36 ms 1128 KB Output is correct
16 Correct 35 ms 1100 KB Output is correct
17 Correct 38 ms 1100 KB Output is correct
18 Correct 40 ms 1100 KB Output is correct
19 Correct 29 ms 1100 KB Output is correct
20 Correct 11 ms 1136 KB Output is correct
21 Correct 11 ms 1100 KB Output is correct
22 Correct 17 ms 1144 KB Output is correct
23 Correct 5 ms 1100 KB Output is correct
24 Correct 9 ms 1140 KB Output is correct
25 Correct 39 ms 1116 KB Output is correct
26 Correct 57 ms 1124 KB Output is correct
27 Correct 52 ms 1100 KB Output is correct
28 Correct 11 ms 1100 KB Output is correct
29 Correct 47 ms 1100 KB Output is correct
30 Correct 21 ms 1132 KB Output is correct
31 Correct 46 ms 1116 KB Output is correct
32 Correct 37 ms 1100 KB Output is correct
33 Correct 33 ms 1100 KB Output is correct
34 Correct 12 ms 1076 KB Output is correct
35 Correct 41 ms 1228 KB Output is correct
36 Correct 39 ms 1144 KB Output is correct
37 Correct 38 ms 1100 KB Output is correct
38 Correct 41 ms 1100 KB Output is correct
39 Correct 33 ms 1100 KB Output is correct
40 Correct 12 ms 1136 KB Output is correct
41 Correct 11 ms 1132 KB Output is correct
42 Correct 18 ms 1144 KB Output is correct
43 Correct 5 ms 1100 KB Output is correct
44 Correct 8 ms 1136 KB Output is correct
45 Correct 39 ms 1080 KB Output is correct
46 Correct 53 ms 1088 KB Output is correct
47 Correct 50 ms 1100 KB Output is correct
48 Correct 13 ms 1100 KB Output is correct
49 Correct 49 ms 1112 KB Output is correct
50 Correct 20 ms 1100 KB Output is correct
51 Correct 46 ms 1100 KB Output is correct
52 Correct 38 ms 1120 KB Output is correct
53 Correct 33 ms 1140 KB Output is correct
54 Correct 13 ms 1228 KB Output is correct
55 Correct 43 ms 1076 KB Output is correct
56 Correct 42 ms 1100 KB Output is correct
57 Correct 39 ms 1076 KB Output is correct
58 Correct 40 ms 1140 KB Output is correct
59 Correct 30 ms 1100 KB Output is correct
60 Correct 13 ms 1132 KB Output is correct
61 Correct 11 ms 1100 KB Output is correct
62 Correct 16 ms 1100 KB Output is correct
63 Correct 5 ms 1140 KB Output is correct
64 Correct 8 ms 1144 KB Output is correct
65 Correct 38 ms 1128 KB Output is correct
66 Correct 51 ms 1100 KB Output is correct
67 Correct 50 ms 1100 KB Output is correct
68 Correct 11 ms 1100 KB Output is correct
69 Correct 49 ms 1100 KB Output is correct
70 Correct 20 ms 1100 KB Output is correct
71 Correct 47 ms 1100 KB Output is correct
72 Correct 37 ms 1100 KB Output is correct
73 Correct 35 ms 1100 KB Output is correct
74 Correct 12 ms 1136 KB Output is correct
75 Correct 39 ms 1100 KB Output is correct
76 Correct 36 ms 1120 KB Output is correct
77 Correct 40 ms 1132 KB Output is correct
78 Correct 46 ms 1100 KB Output is correct
79 Correct 28 ms 1100 KB Output is correct
80 Correct 12 ms 1136 KB Output is correct
81 Correct 11 ms 1100 KB Output is correct
82 Correct 16 ms 1136 KB Output is correct
83 Correct 5 ms 1100 KB Output is correct
84 Correct 8 ms 1136 KB Output is correct
85 Correct 37 ms 1220 KB Output is correct
86 Correct 53 ms 1100 KB Output is correct
87 Correct 49 ms 1100 KB Output is correct
88 Correct 10 ms 1076 KB Output is correct
89 Correct 48 ms 1112 KB Output is correct
90 Correct 20 ms 1136 KB Output is correct
91 Correct 46 ms 1100 KB Output is correct
92 Correct 37 ms 1100 KB Output is correct
93 Correct 37 ms 1100 KB Output is correct
94 Correct 15 ms 1140 KB Output is correct
95 Correct 36 ms 1136 KB Output is correct
96 Correct 36 ms 1140 KB Output is correct
97 Correct 38 ms 1100 KB Output is correct
98 Correct 40 ms 1100 KB Output is correct
99 Correct 29 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 1140 KB Output is correct
2 Correct 55 ms 1120 KB Output is correct
3 Correct 56 ms 1100 KB Output is correct
4 Correct 55 ms 1076 KB Output is correct
5 Correct 54 ms 1100 KB Output is correct
6 Correct 53 ms 1120 KB Output is correct
7 Correct 56 ms 1100 KB Output is correct
8 Correct 56 ms 1140 KB Output is correct
9 Correct 55 ms 1132 KB Output is correct
10 Correct 52 ms 1108 KB Output is correct
11 Correct 4 ms 1100 KB Output is correct
12 Correct 1 ms 1100 KB Output is correct
13 Correct 2 ms 1100 KB Output is correct
14 Correct 3 ms 1100 KB Output is correct
15 Correct 5 ms 1076 KB Output is correct
16 Correct 2 ms 1100 KB Output is correct
17 Correct 55 ms 1120 KB Output is correct
18 Correct 54 ms 1116 KB Output is correct
19 Correct 55 ms 1220 KB Output is correct
20 Correct 52 ms 1100 KB Output is correct
21 Correct 53 ms 1100 KB Output is correct
22 Correct 56 ms 1120 KB Output is correct
23 Correct 65 ms 1100 KB Output is correct
24 Correct 55 ms 1100 KB Output is correct
25 Correct 52 ms 1100 KB Output is correct
26 Correct 55 ms 1100 KB Output is correct
27 Correct 55 ms 1100 KB Output is correct
28 Correct 56 ms 1100 KB Output is correct
29 Correct 54 ms 1100 KB Output is correct
30 Correct 64 ms 1116 KB Output is correct
31 Correct 4 ms 1100 KB Output is correct
32 Correct 1 ms 1100 KB Output is correct
33 Correct 2 ms 1100 KB Output is correct
34 Correct 3 ms 1076 KB Output is correct
35 Correct 6 ms 1140 KB Output is correct
36 Correct 2 ms 1100 KB Output is correct
37 Correct 61 ms 1128 KB Output is correct
38 Correct 53 ms 1100 KB Output is correct
39 Correct 56 ms 1228 KB Output is correct
40 Correct 49 ms 1108 KB Output is correct
41 Correct 53 ms 1124 KB Output is correct
42 Correct 53 ms 1100 KB Output is correct
43 Correct 62 ms 1100 KB Output is correct
44 Correct 55 ms 1100 KB Output is correct
45 Correct 55 ms 1100 KB Output is correct
46 Correct 53 ms 1220 KB Output is correct
47 Correct 55 ms 1144 KB Output is correct
48 Correct 58 ms 1124 KB Output is correct
49 Correct 55 ms 1100 KB Output is correct
50 Correct 54 ms 1100 KB Output is correct
51 Correct 4 ms 1100 KB Output is correct
52 Correct 1 ms 1100 KB Output is correct
53 Correct 2 ms 1100 KB Output is correct
54 Correct 3 ms 1100 KB Output is correct
55 Correct 5 ms 1136 KB Output is correct
56 Correct 2 ms 1100 KB Output is correct
57 Correct 58 ms 1080 KB Output is correct
58 Correct 62 ms 1120 KB Output is correct
59 Correct 56 ms 1120 KB Output is correct
60 Correct 49 ms 1100 KB Output is correct
61 Correct 53 ms 1144 KB Output is correct
62 Correct 56 ms 1100 KB Output is correct
63 Correct 58 ms 1100 KB Output is correct
64 Correct 57 ms 1100 KB Output is correct
65 Correct 54 ms 1116 KB Output is correct
66 Correct 54 ms 1100 KB Output is correct
67 Correct 55 ms 1100 KB Output is correct
68 Correct 59 ms 1100 KB Output is correct
69 Correct 55 ms 1112 KB Output is correct
70 Correct 51 ms 1100 KB Output is correct
71 Correct 4 ms 1100 KB Output is correct
72 Correct 1 ms 1100 KB Output is correct
73 Correct 3 ms 1100 KB Output is correct
74 Correct 3 ms 1100 KB Output is correct
75 Correct 5 ms 1100 KB Output is correct
76 Correct 2 ms 1100 KB Output is correct
77 Correct 63 ms 1100 KB Output is correct
78 Correct 55 ms 1120 KB Output is correct
79 Correct 54 ms 1100 KB Output is correct
80 Correct 54 ms 1116 KB Output is correct
81 Correct 54 ms 1128 KB Output is correct
82 Correct 65 ms 1088 KB Output is correct
83 Correct 57 ms 1100 KB Output is correct
84 Correct 56 ms 1108 KB Output is correct
85 Correct 54 ms 1100 KB Output is correct
86 Correct 54 ms 1116 KB Output is correct
87 Correct 55 ms 1100 KB Output is correct
88 Correct 56 ms 1100 KB Output is correct
89 Correct 54 ms 1100 KB Output is correct
90 Correct 52 ms 1100 KB Output is correct
91 Correct 4 ms 1100 KB Output is correct
92 Correct 1 ms 1100 KB Output is correct
93 Correct 3 ms 1100 KB Output is correct
94 Correct 3 ms 1100 KB Output is correct
95 Correct 5 ms 1100 KB Output is correct
96 Correct 3 ms 1100 KB Output is correct
97 Correct 55 ms 1100 KB Output is correct
98 Correct 53 ms 1124 KB Output is correct
99 Correct 56 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 1100 KB Output is correct
2 Correct 53 ms 1124 KB Output is correct
3 Correct 51 ms 1100 KB Output is correct
4 Correct 56 ms 1116 KB Output is correct
5 Correct 53 ms 1100 KB Output is correct
6 Correct 53 ms 1100 KB Output is correct
7 Correct 55 ms 1100 KB Output is correct
8 Correct 53 ms 1100 KB Output is correct
9 Correct 50 ms 1120 KB Output is correct
10 Correct 57 ms 1100 KB Output is correct
11 Correct 4 ms 1100 KB Output is correct
12 Correct 1 ms 1076 KB Output is correct
13 Correct 9 ms 1148 KB Output is correct
14 Correct 5 ms 1100 KB Output is correct
15 Correct 14 ms 1100 KB Output is correct
16 Correct 8 ms 1100 KB Output is correct
17 Correct 69 ms 1124 KB Output is correct
18 Correct 70 ms 1120 KB Output is correct
19 Correct 39 ms 1124 KB Output is correct
20 Correct 39 ms 1100 KB Output is correct
21 Correct 75 ms 1140 KB Output is correct
22 Correct 54 ms 1100 KB Output is correct
23 Correct 48 ms 1120 KB Output is correct
24 Correct 55 ms 1116 KB Output is correct
25 Correct 53 ms 1100 KB Output is correct
26 Correct 63 ms 1120 KB Output is correct
27 Correct 54 ms 1100 KB Output is correct
28 Correct 55 ms 1100 KB Output is correct
29 Correct 50 ms 1132 KB Output is correct
30 Correct 55 ms 1112 KB Output is correct
31 Correct 3 ms 1100 KB Output is correct
32 Correct 1 ms 1100 KB Output is correct
33 Correct 12 ms 1100 KB Output is correct
34 Correct 5 ms 1100 KB Output is correct
35 Correct 14 ms 1136 KB Output is correct
36 Correct 7 ms 1100 KB Output is correct
37 Correct 70 ms 1100 KB Output is correct
38 Correct 82 ms 1100 KB Output is correct
39 Correct 40 ms 1084 KB Output is correct
40 Correct 50 ms 1100 KB Output is correct
41 Correct 74 ms 1100 KB Output is correct
42 Correct 56 ms 1100 KB Output is correct
43 Correct 55 ms 1100 KB Output is correct
44 Correct 56 ms 1100 KB Output is correct
45 Correct 55 ms 1100 KB Output is correct
46 Correct 59 ms 1100 KB Output is correct
47 Correct 56 ms 1120 KB Output is correct
48 Correct 54 ms 1100 KB Output is correct
49 Correct 59 ms 1100 KB Output is correct
50 Correct 53 ms 1100 KB Output is correct
51 Correct 3 ms 1100 KB Output is correct
52 Correct 1 ms 1100 KB Output is correct
53 Correct 9 ms 1080 KB Output is correct
54 Correct 5 ms 1100 KB Output is correct
55 Correct 17 ms 1100 KB Output is correct
56 Correct 7 ms 1148 KB Output is correct
57 Correct 71 ms 1100 KB Output is correct
58 Correct 70 ms 1136 KB Output is correct
59 Correct 38 ms 1100 KB Output is correct
60 Correct 39 ms 1100 KB Output is correct
61 Correct 71 ms 1100 KB Output is correct
62 Correct 56 ms 1120 KB Output is correct
63 Correct 49 ms 1124 KB Output is correct
64 Correct 56 ms 1100 KB Output is correct
65 Correct 56 ms 1108 KB Output is correct
66 Correct 55 ms 1100 KB Output is correct
67 Correct 61 ms 1100 KB Output is correct
68 Correct 64 ms 1100 KB Output is correct
69 Correct 52 ms 1100 KB Output is correct
70 Correct 52 ms 1100 KB Output is correct
71 Correct 3 ms 1100 KB Output is correct
72 Correct 2 ms 1100 KB Output is correct
73 Correct 10 ms 1148 KB Output is correct
74 Correct 5 ms 1100 KB Output is correct
75 Correct 16 ms 1140 KB Output is correct
76 Correct 8 ms 1144 KB Output is correct
77 Correct 71 ms 1100 KB Output is correct
78 Correct 70 ms 1100 KB Output is correct
79 Correct 42 ms 1112 KB Output is correct
80 Correct 39 ms 1100 KB Output is correct
81 Correct 74 ms 1120 KB Output is correct
82 Correct 57 ms 1100 KB Output is correct
83 Correct 50 ms 1120 KB Output is correct
84 Correct 56 ms 1100 KB Output is correct
85 Correct 62 ms 1100 KB Output is correct
86 Correct 54 ms 1084 KB Output is correct
87 Correct 54 ms 1100 KB Output is correct
88 Correct 56 ms 1120 KB Output is correct
89 Correct 60 ms 1100 KB Output is correct
90 Correct 55 ms 1108 KB Output is correct
91 Correct 3 ms 1100 KB Output is correct
92 Correct 1 ms 1100 KB Output is correct
93 Correct 9 ms 1100 KB Output is correct
94 Correct 5 ms 1100 KB Output is correct
95 Correct 14 ms 1140 KB Output is correct
96 Correct 7 ms 1100 KB Output is correct
97 Correct 70 ms 1220 KB Output is correct
98 Correct 71 ms 1124 KB Output is correct
99 Correct 44 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1100 KB Output is correct
2 Correct 1 ms 1100 KB Output is correct
3 Correct 1 ms 1100 KB Output is correct
4 Correct 1 ms 1076 KB Output is correct
5 Correct 1 ms 1072 KB Output is correct
6 Correct 1 ms 1100 KB Output is correct
7 Correct 1 ms 1100 KB Output is correct
8 Incorrect 1 ms 1100 KB 1st lines differ - on the 1st token, expected: '5', found: '4'
9 Halted 0 ms 0 KB -