답안 #439322

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
439322 2021-06-29T15:36:13 Z Tc14 Jelly Flavours (IOI20_jelly) C++17
24 / 100
264 ms 152800 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;

int find_maximum_unique(int x, int y, ve<int> A, ve<int> B) {

    int n = (int)A.size();
    ve<ve<int>> DPA(n + 1, ve<int>(x + 1, INF));
    ve<ve<int>> DPB(n + 1, ve<int>(y + 1, INF));
    ve<pii> F(n);

    for (int i = 0; i < n; i++) {
        F[i] = {A[i], B[i]};
    }
    sort(F.begin(), F.end());

    DPA[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= x; j++) {

            int a = j - F[i - 1].first;
            if (a >= 0) {
                DPA[i][j] = min(DPA[i][j], DPA[i - 1][a]);
            }

            if (DPA[i - 1][j] != INF) {
                int b = DPA[i - 1][j] + F[i - 1].second;
                if (b <= y) {
                    DPA[i][j] = min(DPA[i][j], b);
                }
            }

        }
    }

    DPB[n] = ve<int>(y + 1, 0);
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j <= y; j++) {
            DPB[i][j] = DPB[i + 1][j];
            int b = j - F[i].second;
            if (b >= 0) {
                DPB[i][j] = max(DPB[i][j], DPB[i + 1][b]);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= x; j++) {
            int b = DPA[i][j];
            if (b != INF) {
                ans = max(ans, i + DPB[i][y - b]);
            }
        }
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 13388 KB 1st lines differ - on the 1st token, expected: '689', found: '65'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 138 ms 81736 KB Output is correct
2 Correct 174 ms 146748 KB Output is correct
3 Correct 177 ms 145128 KB Output is correct
4 Correct 264 ms 148492 KB Output is correct
5 Correct 239 ms 152744 KB Output is correct
6 Correct 171 ms 144532 KB Output is correct
7 Correct 174 ms 145372 KB Output is correct
8 Correct 164 ms 147784 KB Output is correct
9 Correct 228 ms 142100 KB Output is correct
10 Correct 238 ms 146680 KB Output is correct
11 Correct 72 ms 79092 KB Output is correct
12 Correct 2 ms 460 KB Output is correct
13 Correct 67 ms 73808 KB Output is correct
14 Correct 73 ms 75632 KB Output is correct
15 Correct 78 ms 77744 KB Output is correct
16 Correct 67 ms 72864 KB Output is correct
17 Correct 106 ms 73160 KB Output is correct
18 Correct 119 ms 82860 KB Output is correct
19 Correct 152 ms 82740 KB Output is correct
20 Correct 123 ms 70876 KB Output is correct
21 Correct 114 ms 81804 KB Output is correct
22 Correct 170 ms 146868 KB Output is correct
23 Correct 167 ms 144944 KB Output is correct
24 Correct 257 ms 148416 KB Output is correct
25 Correct 240 ms 152776 KB Output is correct
26 Correct 165 ms 144416 KB Output is correct
27 Correct 173 ms 145380 KB Output is correct
28 Correct 181 ms 147840 KB Output is correct
29 Correct 224 ms 142148 KB Output is correct
30 Correct 233 ms 146684 KB Output is correct
31 Correct 74 ms 79080 KB Output is correct
32 Correct 2 ms 460 KB Output is correct
33 Correct 80 ms 73860 KB Output is correct
34 Correct 75 ms 75704 KB Output is correct
35 Correct 77 ms 77720 KB Output is correct
36 Correct 71 ms 72864 KB Output is correct
37 Correct 107 ms 73156 KB Output is correct
38 Correct 126 ms 82860 KB Output is correct
39 Correct 152 ms 82828 KB Output is correct
40 Correct 124 ms 70876 KB Output is correct
41 Correct 115 ms 81708 KB Output is correct
42 Correct 164 ms 146716 KB Output is correct
43 Correct 167 ms 144964 KB Output is correct
44 Correct 242 ms 148416 KB Output is correct
45 Correct 247 ms 152764 KB Output is correct
46 Correct 168 ms 144496 KB Output is correct
47 Correct 165 ms 145360 KB Output is correct
48 Correct 208 ms 147808 KB Output is correct
49 Correct 226 ms 142072 KB Output is correct
50 Correct 231 ms 146624 KB Output is correct
51 Correct 72 ms 79172 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 76 ms 73812 KB Output is correct
54 Correct 75 ms 75664 KB Output is correct
55 Correct 77 ms 77636 KB Output is correct
56 Correct 64 ms 72748 KB Output is correct
57 Correct 103 ms 73120 KB Output is correct
58 Correct 117 ms 82764 KB Output is correct
59 Correct 147 ms 82828 KB Output is correct
60 Correct 125 ms 70880 KB Output is correct
61 Correct 128 ms 81768 KB Output is correct
62 Correct 172 ms 146720 KB Output is correct
63 Correct 167 ms 144940 KB Output is correct
64 Correct 237 ms 148460 KB Output is correct
65 Correct 239 ms 152800 KB Output is correct
66 Correct 164 ms 144428 KB Output is correct
67 Correct 165 ms 145352 KB Output is correct
68 Correct 184 ms 147948 KB Output is correct
69 Correct 237 ms 142164 KB Output is correct
70 Correct 234 ms 146628 KB Output is correct
71 Correct 74 ms 79140 KB Output is correct
72 Correct 1 ms 460 KB Output is correct
73 Correct 66 ms 73796 KB Output is correct
74 Correct 71 ms 75740 KB Output is correct
75 Correct 81 ms 77716 KB Output is correct
76 Correct 67 ms 72864 KB Output is correct
77 Correct 110 ms 73164 KB Output is correct
78 Correct 140 ms 82856 KB Output is correct
79 Correct 149 ms 82796 KB Output is correct
80 Correct 123 ms 70880 KB Output is correct
81 Correct 137 ms 81772 KB Output is correct
82 Correct 169 ms 146872 KB Output is correct
83 Correct 170 ms 144964 KB Output is correct
84 Correct 238 ms 148436 KB Output is correct
85 Correct 238 ms 152772 KB Output is correct
86 Correct 166 ms 144528 KB Output is correct
87 Correct 164 ms 145348 KB Output is correct
88 Correct 172 ms 147868 KB Output is correct
89 Correct 234 ms 142156 KB Output is correct
90 Correct 233 ms 146636 KB Output is correct
91 Correct 78 ms 79184 KB Output is correct
92 Correct 1 ms 460 KB Output is correct
93 Correct 68 ms 73788 KB Output is correct
94 Correct 91 ms 75668 KB Output is correct
95 Correct 80 ms 77644 KB Output is correct
96 Correct 66 ms 72820 KB Output is correct
97 Correct 112 ms 73132 KB Output is correct
98 Correct 140 ms 82824 KB Output is correct
99 Correct 151 ms 82832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 123 ms 79544 KB Output is correct
2 Correct 171 ms 141516 KB Output is correct
3 Correct 167 ms 140484 KB Output is correct
4 Correct 225 ms 148160 KB Output is correct
5 Correct 244 ms 143840 KB Output is correct
6 Correct 167 ms 145732 KB Output is correct
7 Correct 167 ms 147172 KB Output is correct
8 Correct 162 ms 143556 KB Output is correct
9 Correct 222 ms 142488 KB Output is correct
10 Correct 230 ms 152416 KB Output is correct
11 Correct 69 ms 74472 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 85 ms 88200 KB Output is correct
14 Correct 79 ms 78324 KB Output is correct
15 Correct 102 ms 84784 KB Output is correct
16 Correct 78 ms 78300 KB Output is correct
17 Correct 136 ms 85800 KB Output is correct
18 Correct 127 ms 85276 KB Output is correct
19 Correct 130 ms 76180 KB Output is correct
20 Correct 132 ms 77384 KB Output is correct
21 Correct 127 ms 79428 KB Output is correct
22 Correct 168 ms 141500 KB Output is correct
23 Correct 167 ms 140484 KB Output is correct
24 Correct 217 ms 148076 KB Output is correct
25 Correct 223 ms 143904 KB Output is correct
26 Correct 165 ms 145804 KB Output is correct
27 Correct 175 ms 147164 KB Output is correct
28 Correct 171 ms 143680 KB Output is correct
29 Correct 215 ms 142580 KB Output is correct
30 Correct 247 ms 152372 KB Output is correct
31 Correct 71 ms 74512 KB Output is correct
32 Correct 1 ms 460 KB Output is correct
33 Correct 86 ms 88172 KB Output is correct
34 Correct 79 ms 78300 KB Output is correct
35 Correct 100 ms 84684 KB Output is correct
36 Correct 75 ms 78276 KB Output is correct
37 Correct 130 ms 85744 KB Output is correct
38 Correct 152 ms 85360 KB Output is correct
39 Correct 131 ms 76356 KB Output is correct
40 Correct 136 ms 77376 KB Output is correct
41 Correct 129 ms 79540 KB Output is correct
42 Correct 173 ms 141520 KB Output is correct
43 Correct 162 ms 140552 KB Output is correct
44 Correct 217 ms 148036 KB Output is correct
45 Correct 230 ms 143828 KB Output is correct
46 Correct 175 ms 145728 KB Output is correct
47 Correct 170 ms 147076 KB Output is correct
48 Correct 171 ms 143556 KB Output is correct
49 Correct 215 ms 142484 KB Output is correct
50 Correct 237 ms 152380 KB Output is correct
51 Correct 71 ms 74524 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 88 ms 88232 KB Output is correct
54 Correct 77 ms 78276 KB Output is correct
55 Correct 102 ms 84752 KB Output is correct
56 Correct 78 ms 78296 KB Output is correct
57 Correct 131 ms 85700 KB Output is correct
58 Correct 129 ms 85380 KB Output is correct
59 Correct 129 ms 76228 KB Output is correct
60 Correct 133 ms 77380 KB Output is correct
61 Correct 130 ms 79464 KB Output is correct
62 Correct 171 ms 141508 KB Output is correct
63 Correct 171 ms 140528 KB Output is correct
64 Correct 229 ms 148088 KB Output is correct
65 Correct 220 ms 143868 KB Output is correct
66 Correct 169 ms 145852 KB Output is correct
67 Correct 169 ms 147132 KB Output is correct
68 Correct 165 ms 143784 KB Output is correct
69 Correct 218 ms 142484 KB Output is correct
70 Correct 232 ms 152388 KB Output is correct
71 Correct 68 ms 74508 KB Output is correct
72 Correct 2 ms 552 KB Output is correct
73 Correct 85 ms 88140 KB Output is correct
74 Correct 77 ms 78268 KB Output is correct
75 Correct 102 ms 84788 KB Output is correct
76 Correct 77 ms 78288 KB Output is correct
77 Correct 141 ms 85752 KB Output is correct
78 Correct 135 ms 85372 KB Output is correct
79 Correct 126 ms 76264 KB Output is correct
80 Correct 137 ms 77376 KB Output is correct
81 Correct 129 ms 79600 KB Output is correct
82 Correct 191 ms 141508 KB Output is correct
83 Correct 172 ms 140548 KB Output is correct
84 Correct 228 ms 148036 KB Output is correct
85 Correct 226 ms 143812 KB Output is correct
86 Correct 169 ms 145836 KB Output is correct
87 Correct 173 ms 147164 KB Output is correct
88 Correct 174 ms 143684 KB Output is correct
89 Correct 216 ms 142376 KB Output is correct
90 Correct 229 ms 152372 KB Output is correct
91 Correct 71 ms 74532 KB Output is correct
92 Correct 2 ms 460 KB Output is correct
93 Correct 98 ms 88168 KB Output is correct
94 Correct 85 ms 78292 KB Output is correct
95 Correct 99 ms 84740 KB Output is correct
96 Correct 81 ms 78288 KB Output is correct
97 Correct 139 ms 85792 KB Output is correct
98 Correct 130 ms 85376 KB Output is correct
99 Correct 133 ms 76188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -