답안 #476402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
476402 2021-09-26T10:25:21 Z starplat Jelly Flavours (IOI20_jelly) C++14
9 / 100
72 ms 1220 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]={b[i-1],a[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++) swap(v[i].f,v[i].s);
	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<=x) ans=max(dp[i].f,ans);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 972 KB Output is correct
2 Correct 1 ms 972 KB Output is correct
3 Correct 1 ms 972 KB Output is correct
4 Correct 1 ms 972 KB Output is correct
5 Correct 1 ms 972 KB Output is correct
6 Incorrect 1 ms 972 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 972 KB Output is correct
2 Correct 1 ms 972 KB Output is correct
3 Correct 1 ms 972 KB Output is correct
4 Correct 1 ms 972 KB Output is correct
5 Correct 1 ms 972 KB Output is correct
6 Incorrect 1 ms 972 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1100 KB Output is correct
2 Correct 17 ms 1120 KB Output is correct
3 Correct 6 ms 1100 KB Output is correct
4 Correct 9 ms 1128 KB Output is correct
5 Correct 47 ms 1108 KB Output is correct
6 Correct 54 ms 1104 KB Output is correct
7 Correct 57 ms 1108 KB Output is correct
8 Correct 11 ms 1100 KB Output is correct
9 Correct 60 ms 1104 KB Output is correct
10 Correct 22 ms 1120 KB Output is correct
11 Correct 48 ms 1100 KB Output is correct
12 Correct 40 ms 1100 KB Output is correct
13 Correct 33 ms 1100 KB Output is correct
14 Correct 13 ms 1128 KB Output is correct
15 Correct 43 ms 1116 KB Output is correct
16 Correct 37 ms 1100 KB Output is correct
17 Correct 38 ms 1100 KB Output is correct
18 Correct 41 ms 1100 KB Output is correct
19 Correct 34 ms 1100 KB Output is correct
20 Correct 13 ms 1120 KB Output is correct
21 Correct 11 ms 1100 KB Output is correct
22 Correct 17 ms 1124 KB Output is correct
23 Correct 5 ms 1100 KB Output is correct
24 Correct 10 ms 1100 KB Output is correct
25 Correct 49 ms 1116 KB Output is correct
26 Correct 57 ms 1112 KB Output is correct
27 Correct 52 ms 1220 KB Output is correct
28 Correct 11 ms 1100 KB Output is correct
29 Correct 63 ms 1100 KB Output is correct
30 Correct 23 ms 1100 KB Output is correct
31 Correct 49 ms 1080 KB Output is correct
32 Correct 48 ms 1100 KB Output is correct
33 Correct 35 ms 1100 KB Output is correct
34 Correct 15 ms 1124 KB Output is correct
35 Correct 44 ms 1104 KB Output is correct
36 Correct 36 ms 1104 KB Output is correct
37 Correct 39 ms 1104 KB Output is correct
38 Correct 41 ms 1100 KB Output is correct
39 Correct 34 ms 1100 KB Output is correct
40 Correct 14 ms 1116 KB Output is correct
41 Correct 13 ms 1132 KB Output is correct
42 Correct 18 ms 1128 KB Output is correct
43 Correct 7 ms 1100 KB Output is correct
44 Correct 9 ms 1100 KB Output is correct
45 Correct 45 ms 1104 KB Output is correct
46 Correct 59 ms 1100 KB Output is correct
47 Correct 51 ms 1104 KB Output is correct
48 Correct 11 ms 1128 KB Output is correct
49 Correct 60 ms 1100 KB Output is correct
50 Correct 22 ms 1128 KB Output is correct
51 Correct 46 ms 1100 KB Output is correct
52 Correct 37 ms 1100 KB Output is correct
53 Correct 34 ms 1100 KB Output is correct
54 Correct 13 ms 1124 KB Output is correct
55 Correct 44 ms 1112 KB Output is correct
56 Correct 36 ms 1100 KB Output is correct
57 Correct 42 ms 1220 KB Output is correct
58 Correct 43 ms 1100 KB Output is correct
59 Correct 35 ms 1100 KB Output is correct
60 Correct 13 ms 1100 KB Output is correct
61 Correct 12 ms 1120 KB Output is correct
62 Correct 16 ms 1100 KB Output is correct
63 Correct 5 ms 1120 KB Output is correct
64 Correct 9 ms 1100 KB Output is correct
65 Correct 47 ms 1100 KB Output is correct
66 Correct 53 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 60 ms 1104 KB Output is correct
70 Correct 23 ms 1100 KB Output is correct
71 Correct 49 ms 1104 KB Output is correct
72 Correct 42 ms 1100 KB Output is correct
73 Correct 33 ms 1100 KB Output is correct
74 Correct 14 ms 1120 KB Output is correct
75 Correct 41 ms 1100 KB Output is correct
76 Correct 36 ms 1100 KB Output is correct
77 Correct 40 ms 1100 KB Output is correct
78 Correct 42 ms 1100 KB Output is correct
79 Correct 34 ms 1100 KB Output is correct
80 Correct 13 ms 1100 KB Output is correct
81 Correct 11 ms 1100 KB Output is correct
82 Correct 17 ms 1100 KB Output is correct
83 Correct 5 ms 1100 KB Output is correct
84 Correct 9 ms 1100 KB Output is correct
85 Correct 45 ms 1220 KB Output is correct
86 Correct 53 ms 1100 KB Output is correct
87 Correct 51 ms 1100 KB Output is correct
88 Correct 11 ms 1128 KB Output is correct
89 Correct 60 ms 1104 KB Output is correct
90 Correct 22 ms 1120 KB Output is correct
91 Correct 48 ms 1100 KB Output is correct
92 Correct 38 ms 1100 KB Output is correct
93 Correct 33 ms 1100 KB Output is correct
94 Correct 13 ms 1112 KB Output is correct
95 Correct 43 ms 1100 KB Output is correct
96 Correct 36 ms 1100 KB Output is correct
97 Correct 38 ms 1100 KB Output is correct
98 Correct 41 ms 1124 KB Output is correct
99 Correct 34 ms 1100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 1100 KB Output is correct
2 Correct 55 ms 1100 KB Output is correct
3 Correct 56 ms 1100 KB Output is correct
4 Correct 56 ms 1100 KB Output is correct
5 Correct 54 ms 1104 KB Output is correct
6 Correct 55 ms 1100 KB Output is correct
7 Correct 54 ms 1132 KB Output is correct
8 Correct 56 ms 1108 KB Output is correct
9 Correct 54 ms 1100 KB Output is correct
10 Correct 57 ms 1104 KB Output is correct
11 Incorrect 5 ms 1100 KB 1st lines differ - on the 1st token, expected: '63', found: '0'
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 1100 KB Output is correct
2 Correct 58 ms 1100 KB Output is correct
3 Correct 52 ms 1100 KB Output is correct
4 Correct 54 ms 1108 KB Output is correct
5 Incorrect 54 ms 1104 KB 1st lines differ - on the 1st token, expected: '1867', found: '0'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 972 KB Output is correct
2 Correct 1 ms 972 KB Output is correct
3 Correct 1 ms 972 KB Output is correct
4 Correct 1 ms 972 KB Output is correct
5 Correct 1 ms 972 KB Output is correct
6 Incorrect 1 ms 972 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
7 Halted 0 ms 0 KB -