답안 #316948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
316948 2020-10-28T16:41:30 Z mihai145 Jelly Flavours (IOI20_jelly) C++14
24 / 100
249 ms 78712 KB
#include "jelly.h"
#include <vector>
#include <algorithm>

const int NMAX = 2000;
const int XMAX = 10000;
const int INF = 10 * XMAX;

std::vector < std::pair <int, int> > pairs;
int dp[NMAX + 2][XMAX + 2];

int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int n = (int)a.size();

	for(int i = 0; i < n; i++)
        pairs.push_back({a[i], b[i]});

	sort(pairs.begin(), pairs.end());

	for(int i = 1; i <= n; i++)
        for(int bugA = 0; bugA <= x; bugA++)
            dp[i][bugA] = INF;

    for(int i = 0; i < n; i++)
        for(int bugA = 0; bugA <= x; bugA++)
            if(dp[i][bugA] <= y)
            {
                ///cumpar i + 1 din A
                if(bugA + pairs[i].first <= x)
                    dp[i + 1][bugA + pairs[i].first] = std::min(dp[i + 1][bugA + pairs[i].first], dp[i][bugA]);

                ///cumpar i + 1 din B
                dp[i + 1][bugA] = std::min(dp[i + 1][bugA], dp[i][bugA] + pairs[i].second);
            }

    std::vector <int> sufb;
    int sol = 0;

    for(int i = n; i >= 0; i--)
        {
            int minY = INF;
            for(int bugA = 0; bugA <= x; bugA++)
                minY = std::min(minY, dp[i][bugA]);

            if(minY <= y) {
                int placed = i; ///pref

                if(i + 1 <= n)
                    sufb.push_back(pairs[i].second);

                sort(sufb.begin(), sufb.end());

                int remBudget = y - minY;
                for(auto it : sufb)
                if(remBudget >= it) {
                    remBudget -= it;
                    placed++;
                } else
                    break;

                sol = std::max(sol, placed);
            }
        }

	return sol;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 21248 KB 1st lines differ - on the 1st token, expected: '689', found: '65'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 98 ms 76152 KB Output is correct
2 Correct 93 ms 78072 KB Output is correct
3 Correct 97 ms 78328 KB Output is correct
4 Correct 177 ms 75000 KB Output is correct
5 Correct 185 ms 77688 KB Output is correct
6 Correct 92 ms 74872 KB Output is correct
7 Correct 95 ms 77304 KB Output is correct
8 Correct 95 ms 75256 KB Output is correct
9 Correct 167 ms 75228 KB Output is correct
10 Correct 168 ms 76280 KB Output is correct
11 Correct 11 ms 12416 KB Output is correct
12 Correct 5 ms 8064 KB Output is correct
13 Correct 7 ms 9600 KB Output is correct
14 Correct 23 ms 9728 KB Output is correct
15 Correct 18 ms 12160 KB Output is correct
16 Correct 6 ms 8832 KB Output is correct
17 Correct 103 ms 78584 KB Output is correct
18 Correct 92 ms 74744 KB Output is correct
19 Correct 146 ms 76664 KB Output is correct
20 Correct 130 ms 77176 KB Output is correct
21 Correct 92 ms 76152 KB Output is correct
22 Correct 97 ms 77944 KB Output is correct
23 Correct 96 ms 78328 KB Output is correct
24 Correct 175 ms 75004 KB Output is correct
25 Correct 179 ms 77816 KB Output is correct
26 Correct 92 ms 74872 KB Output is correct
27 Correct 104 ms 77308 KB Output is correct
28 Correct 105 ms 75256 KB Output is correct
29 Correct 172 ms 75256 KB Output is correct
30 Correct 173 ms 76288 KB Output is correct
31 Correct 11 ms 12416 KB Output is correct
32 Correct 5 ms 8064 KB Output is correct
33 Correct 7 ms 9600 KB Output is correct
34 Correct 23 ms 9728 KB Output is correct
35 Correct 18 ms 12160 KB Output is correct
36 Correct 6 ms 8832 KB Output is correct
37 Correct 95 ms 78712 KB Output is correct
38 Correct 92 ms 74848 KB Output is correct
39 Correct 142 ms 76668 KB Output is correct
40 Correct 130 ms 77108 KB Output is correct
41 Correct 91 ms 76128 KB Output is correct
42 Correct 94 ms 77944 KB Output is correct
43 Correct 97 ms 78328 KB Output is correct
44 Correct 175 ms 75000 KB Output is correct
45 Correct 181 ms 77688 KB Output is correct
46 Correct 93 ms 74872 KB Output is correct
47 Correct 92 ms 77304 KB Output is correct
48 Correct 93 ms 75256 KB Output is correct
49 Correct 184 ms 75256 KB Output is correct
50 Correct 172 ms 76280 KB Output is correct
51 Correct 11 ms 12416 KB Output is correct
52 Correct 5 ms 8064 KB Output is correct
53 Correct 7 ms 9600 KB Output is correct
54 Correct 26 ms 9728 KB Output is correct
55 Correct 18 ms 12288 KB Output is correct
56 Correct 6 ms 8832 KB Output is correct
57 Correct 94 ms 78584 KB Output is correct
58 Correct 93 ms 74872 KB Output is correct
59 Correct 147 ms 76664 KB Output is correct
60 Correct 130 ms 77176 KB Output is correct
61 Correct 94 ms 76152 KB Output is correct
62 Correct 93 ms 78072 KB Output is correct
63 Correct 95 ms 78332 KB Output is correct
64 Correct 172 ms 75000 KB Output is correct
65 Correct 179 ms 77688 KB Output is correct
66 Correct 90 ms 74872 KB Output is correct
67 Correct 95 ms 77304 KB Output is correct
68 Correct 95 ms 75260 KB Output is correct
69 Correct 172 ms 75256 KB Output is correct
70 Correct 173 ms 76280 KB Output is correct
71 Correct 11 ms 12416 KB Output is correct
72 Correct 5 ms 8064 KB Output is correct
73 Correct 7 ms 9600 KB Output is correct
74 Correct 27 ms 9856 KB Output is correct
75 Correct 18 ms 12160 KB Output is correct
76 Correct 6 ms 8832 KB Output is correct
77 Correct 93 ms 78584 KB Output is correct
78 Correct 90 ms 74744 KB Output is correct
79 Correct 145 ms 76664 KB Output is correct
80 Correct 130 ms 77048 KB Output is correct
81 Correct 92 ms 76152 KB Output is correct
82 Correct 94 ms 77944 KB Output is correct
83 Correct 95 ms 78328 KB Output is correct
84 Correct 175 ms 75000 KB Output is correct
85 Correct 180 ms 77688 KB Output is correct
86 Correct 92 ms 74872 KB Output is correct
87 Correct 92 ms 77304 KB Output is correct
88 Correct 94 ms 75296 KB Output is correct
89 Correct 174 ms 75256 KB Output is correct
90 Correct 180 ms 76284 KB Output is correct
91 Correct 11 ms 12416 KB Output is correct
92 Correct 5 ms 8064 KB Output is correct
93 Correct 7 ms 9600 KB Output is correct
94 Correct 23 ms 9728 KB Output is correct
95 Correct 18 ms 12160 KB Output is correct
96 Correct 6 ms 8832 KB Output is correct
97 Correct 94 ms 78584 KB Output is correct
98 Correct 90 ms 74744 KB Output is correct
99 Correct 146 ms 76772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 77048 KB Output is correct
2 Correct 95 ms 75256 KB Output is correct
3 Correct 92 ms 77304 KB Output is correct
4 Correct 229 ms 76920 KB Output is correct
5 Correct 213 ms 74872 KB Output is correct
6 Correct 95 ms 77048 KB Output is correct
7 Correct 94 ms 77972 KB Output is correct
8 Correct 95 ms 75128 KB Output is correct
9 Correct 222 ms 77432 KB Output is correct
10 Correct 234 ms 78456 KB Output is correct
11 Correct 11 ms 11392 KB Output is correct
12 Correct 5 ms 8320 KB Output is correct
13 Correct 23 ms 22144 KB Output is correct
14 Correct 67 ms 11776 KB Output is correct
15 Correct 92 ms 22784 KB Output is correct
16 Correct 19 ms 18304 KB Output is correct
17 Correct 95 ms 78328 KB Output is correct
18 Correct 97 ms 78328 KB Output is correct
19 Correct 194 ms 77640 KB Output is correct
20 Correct 195 ms 78200 KB Output is correct
21 Correct 94 ms 77048 KB Output is correct
22 Correct 97 ms 75220 KB Output is correct
23 Correct 93 ms 77304 KB Output is correct
24 Correct 241 ms 77048 KB Output is correct
25 Correct 220 ms 74744 KB Output is correct
26 Correct 95 ms 77048 KB Output is correct
27 Correct 94 ms 78036 KB Output is correct
28 Correct 99 ms 75128 KB Output is correct
29 Correct 224 ms 77432 KB Output is correct
30 Correct 234 ms 78456 KB Output is correct
31 Correct 11 ms 11520 KB Output is correct
32 Correct 5 ms 8320 KB Output is correct
33 Correct 24 ms 22136 KB Output is correct
34 Correct 68 ms 11776 KB Output is correct
35 Correct 94 ms 22784 KB Output is correct
36 Correct 19 ms 18304 KB Output is correct
37 Correct 95 ms 78328 KB Output is correct
38 Correct 94 ms 78076 KB Output is correct
39 Correct 192 ms 77648 KB Output is correct
40 Correct 197 ms 78200 KB Output is correct
41 Correct 94 ms 77092 KB Output is correct
42 Correct 96 ms 75256 KB Output is correct
43 Correct 97 ms 77304 KB Output is correct
44 Correct 232 ms 76980 KB Output is correct
45 Correct 216 ms 74744 KB Output is correct
46 Correct 97 ms 77048 KB Output is correct
47 Correct 96 ms 78072 KB Output is correct
48 Correct 93 ms 75136 KB Output is correct
49 Correct 235 ms 77304 KB Output is correct
50 Correct 249 ms 78456 KB Output is correct
51 Correct 11 ms 11392 KB Output is correct
52 Correct 5 ms 8320 KB Output is correct
53 Correct 24 ms 22144 KB Output is correct
54 Correct 68 ms 11776 KB Output is correct
55 Correct 94 ms 22784 KB Output is correct
56 Correct 20 ms 18304 KB Output is correct
57 Correct 96 ms 78328 KB Output is correct
58 Correct 96 ms 78072 KB Output is correct
59 Correct 194 ms 77560 KB Output is correct
60 Correct 197 ms 78200 KB Output is correct
61 Correct 95 ms 77048 KB Output is correct
62 Correct 95 ms 75256 KB Output is correct
63 Correct 93 ms 77304 KB Output is correct
64 Correct 230 ms 77164 KB Output is correct
65 Correct 232 ms 74872 KB Output is correct
66 Correct 93 ms 77048 KB Output is correct
67 Correct 94 ms 78072 KB Output is correct
68 Correct 92 ms 75128 KB Output is correct
69 Correct 223 ms 77432 KB Output is correct
70 Correct 231 ms 78388 KB Output is correct
71 Correct 11 ms 11520 KB Output is correct
72 Correct 5 ms 8320 KB Output is correct
73 Correct 24 ms 22144 KB Output is correct
74 Correct 67 ms 11888 KB Output is correct
75 Correct 92 ms 22784 KB Output is correct
76 Correct 19 ms 18304 KB Output is correct
77 Correct 95 ms 78332 KB Output is correct
78 Correct 94 ms 78072 KB Output is correct
79 Correct 191 ms 77696 KB Output is correct
80 Correct 197 ms 78328 KB Output is correct
81 Correct 95 ms 77048 KB Output is correct
82 Correct 93 ms 75256 KB Output is correct
83 Correct 93 ms 77304 KB Output is correct
84 Correct 232 ms 77048 KB Output is correct
85 Correct 209 ms 74876 KB Output is correct
86 Correct 93 ms 77176 KB Output is correct
87 Correct 94 ms 78072 KB Output is correct
88 Correct 92 ms 75132 KB Output is correct
89 Correct 225 ms 77432 KB Output is correct
90 Correct 231 ms 78328 KB Output is correct
91 Correct 10 ms 11392 KB Output is correct
92 Correct 5 ms 8320 KB Output is correct
93 Correct 25 ms 22144 KB Output is correct
94 Correct 75 ms 11776 KB Output is correct
95 Correct 91 ms 22784 KB Output is correct
96 Correct 19 ms 18304 KB Output is correct
97 Correct 97 ms 78328 KB Output is correct
98 Correct 97 ms 78072 KB Output is correct
99 Correct 194 ms 77688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -