답안 #673216

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673216 2022-12-20T00:10:21 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
33 / 100
118 ms 156424 KB
#include "jelly.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e3 + 10;
const int MAXM = 1e4 + 10;
const int INF = 0x3f3f3f3f;

int dp[MAXN][MAXM];
int dp2[MAXN][MAXM];
int n, a[MAXN], b[MAXN];
vector<pair<int, int>> buga;

int find_maximum_unique(int x, int y, vector<int> _a, vector<int> _b) {
  n = _a.size();

  if (x > y) {
    swap(x, y);
    swap(_a, _b);
  }

  for (int i = 0; i < n; i++) {
    buga.emplace_back(_a[i], _b[i]);
  }

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

  for (int i = 1; i <= n; i++) {
    a[i] = buga[i - 1].first;
    b[i] = buga[i - 1].second;
  }

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

      if (j >= a[i])
        dp[i][j] = max(dp[i][j], dp[i - 1][j - a[i]] + 1);
    }
  }

  for(int i = n, j = x; i >= 1; i--)
  {
      if (j >= a[i] && dp[i][j] == dp[i-1][j - a[i]] + 1) {
        j -= a[i]; b[i] = INF;
      }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= y; j++) {
      dp2[i][j] = dp2[i - 1][j];

      if (j >= b[i])
        dp2[i][j] = max(dp2[i][j], dp2[i - 1][j - b[i]] + 1);
    }
  }

  return (dp[n][x] + dp2[n][y]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 29140 KB Output is correct
2 Correct 20 ms 36388 KB Output is correct
3 Correct 9 ms 21532 KB Output is correct
4 Correct 12 ms 23832 KB Output is correct
5 Correct 43 ms 69104 KB Output is correct
6 Correct 49 ms 83916 KB Output is correct
7 Correct 57 ms 81652 KB Output is correct
8 Correct 14 ms 28628 KB Output is correct
9 Correct 53 ms 85876 KB Output is correct
10 Correct 26 ms 44640 KB Output is correct
11 Correct 44 ms 77388 KB Output is correct
12 Correct 38 ms 64160 KB Output is correct
13 Correct 34 ms 57860 KB Output is correct
14 Correct 16 ms 29268 KB Output is correct
15 Correct 40 ms 64532 KB Output is correct
16 Correct 35 ms 62096 KB Output is correct
17 Correct 37 ms 64736 KB Output is correct
18 Correct 38 ms 68272 KB Output is correct
19 Correct 34 ms 57356 KB Output is correct
20 Correct 15 ms 29140 KB Output is correct
21 Correct 15 ms 29140 KB Output is correct
22 Correct 19 ms 36436 KB Output is correct
23 Correct 10 ms 21540 KB Output is correct
24 Correct 11 ms 23908 KB Output is correct
25 Correct 44 ms 69084 KB Output is correct
26 Correct 48 ms 84060 KB Output is correct
27 Correct 46 ms 81624 KB Output is correct
28 Correct 14 ms 28684 KB Output is correct
29 Correct 54 ms 85812 KB Output is correct
30 Correct 26 ms 44560 KB Output is correct
31 Correct 44 ms 77384 KB Output is correct
32 Correct 36 ms 64076 KB Output is correct
33 Correct 32 ms 57916 KB Output is correct
34 Correct 15 ms 29236 KB Output is correct
35 Correct 44 ms 64584 KB Output is correct
36 Correct 34 ms 62120 KB Output is correct
37 Correct 37 ms 64808 KB Output is correct
38 Correct 38 ms 68308 KB Output is correct
39 Correct 34 ms 57368 KB Output is correct
40 Correct 15 ms 29188 KB Output is correct
41 Correct 14 ms 29144 KB Output is correct
42 Correct 19 ms 36388 KB Output is correct
43 Correct 9 ms 21460 KB Output is correct
44 Correct 11 ms 23916 KB Output is correct
45 Correct 42 ms 69064 KB Output is correct
46 Correct 48 ms 83936 KB Output is correct
47 Correct 49 ms 81636 KB Output is correct
48 Correct 14 ms 28628 KB Output is correct
49 Correct 54 ms 85852 KB Output is correct
50 Correct 27 ms 44656 KB Output is correct
51 Correct 44 ms 77388 KB Output is correct
52 Correct 36 ms 64072 KB Output is correct
53 Correct 36 ms 57932 KB Output is correct
54 Correct 15 ms 29268 KB Output is correct
55 Correct 40 ms 64464 KB Output is correct
56 Correct 35 ms 62144 KB Output is correct
57 Correct 36 ms 64716 KB Output is correct
58 Correct 44 ms 68344 KB Output is correct
59 Correct 34 ms 57300 KB Output is correct
60 Correct 16 ms 29140 KB Output is correct
61 Correct 15 ms 29140 KB Output is correct
62 Correct 23 ms 36428 KB Output is correct
63 Correct 10 ms 21460 KB Output is correct
64 Correct 14 ms 23872 KB Output is correct
65 Correct 44 ms 69068 KB Output is correct
66 Correct 50 ms 83872 KB Output is correct
67 Correct 46 ms 81572 KB Output is correct
68 Correct 15 ms 28612 KB Output is correct
69 Correct 52 ms 85880 KB Output is correct
70 Correct 25 ms 44628 KB Output is correct
71 Correct 44 ms 77352 KB Output is correct
72 Correct 42 ms 64188 KB Output is correct
73 Correct 41 ms 57844 KB Output is correct
74 Correct 16 ms 29220 KB Output is correct
75 Correct 39 ms 64460 KB Output is correct
76 Correct 35 ms 62136 KB Output is correct
77 Correct 36 ms 64736 KB Output is correct
78 Correct 38 ms 68308 KB Output is correct
79 Correct 36 ms 57296 KB Output is correct
80 Correct 15 ms 29140 KB Output is correct
81 Correct 19 ms 29180 KB Output is correct
82 Correct 19 ms 36472 KB Output is correct
83 Correct 10 ms 21436 KB Output is correct
84 Correct 11 ms 23892 KB Output is correct
85 Correct 42 ms 69180 KB Output is correct
86 Correct 48 ms 83900 KB Output is correct
87 Correct 47 ms 81624 KB Output is correct
88 Correct 14 ms 28608 KB Output is correct
89 Correct 56 ms 85860 KB Output is correct
90 Correct 32 ms 44800 KB Output is correct
91 Correct 44 ms 77444 KB Output is correct
92 Correct 36 ms 64128 KB Output is correct
93 Correct 32 ms 57864 KB Output is correct
94 Correct 16 ms 29212 KB Output is correct
95 Correct 41 ms 64492 KB Output is correct
96 Correct 35 ms 62220 KB Output is correct
97 Correct 36 ms 64716 KB Output is correct
98 Correct 41 ms 68300 KB Output is correct
99 Correct 35 ms 57376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94392 KB Output is correct
2 Correct 93 ms 155668 KB Output is correct
3 Correct 91 ms 156332 KB Output is correct
4 Correct 94 ms 149608 KB Output is correct
5 Correct 98 ms 155244 KB Output is correct
6 Correct 93 ms 149488 KB Output is correct
7 Correct 97 ms 154260 KB Output is correct
8 Correct 89 ms 150216 KB Output is correct
9 Correct 118 ms 150148 KB Output is correct
10 Correct 101 ms 152212 KB Output is correct
11 Correct 54 ms 88908 KB Output is correct
12 Correct 6 ms 15828 KB Output is correct
13 Correct 52 ms 86540 KB Output is correct
14 Correct 54 ms 85660 KB Output is correct
15 Correct 55 ms 88536 KB Output is correct
16 Correct 50 ms 84300 KB Output is correct
17 Correct 51 ms 87196 KB Output is correct
18 Correct 56 ms 94300 KB Output is correct
19 Correct 63 ms 90824 KB Output is correct
20 Correct 53 ms 86220 KB Output is correct
21 Correct 61 ms 94420 KB Output is correct
22 Correct 96 ms 155652 KB Output is correct
23 Correct 96 ms 156364 KB Output is correct
24 Correct 95 ms 149620 KB Output is correct
25 Correct 100 ms 155192 KB Output is correct
26 Correct 97 ms 149548 KB Output is correct
27 Correct 94 ms 154324 KB Output is correct
28 Correct 96 ms 150212 KB Output is correct
29 Correct 103 ms 150104 KB Output is correct
30 Correct 96 ms 152304 KB Output is correct
31 Correct 53 ms 88836 KB Output is correct
32 Correct 7 ms 15828 KB Output is correct
33 Correct 54 ms 86584 KB Output is correct
34 Correct 56 ms 85820 KB Output is correct
35 Correct 61 ms 88476 KB Output is correct
36 Correct 53 ms 84168 KB Output is correct
37 Correct 51 ms 87208 KB Output is correct
38 Correct 63 ms 94412 KB Output is correct
39 Correct 62 ms 90788 KB Output is correct
40 Correct 60 ms 86472 KB Output is correct
41 Correct 56 ms 94420 KB Output is correct
42 Correct 91 ms 155748 KB Output is correct
43 Correct 90 ms 156308 KB Output is correct
44 Correct 97 ms 149672 KB Output is correct
45 Correct 101 ms 155376 KB Output is correct
46 Correct 92 ms 149580 KB Output is correct
47 Correct 94 ms 154292 KB Output is correct
48 Correct 89 ms 150280 KB Output is correct
49 Correct 102 ms 150180 KB Output is correct
50 Correct 102 ms 152240 KB Output is correct
51 Correct 54 ms 88864 KB Output is correct
52 Correct 7 ms 15828 KB Output is correct
53 Correct 53 ms 86556 KB Output is correct
54 Correct 55 ms 85580 KB Output is correct
55 Correct 55 ms 88544 KB Output is correct
56 Correct 50 ms 84188 KB Output is correct
57 Correct 58 ms 87208 KB Output is correct
58 Correct 57 ms 94352 KB Output is correct
59 Correct 59 ms 90784 KB Output is correct
60 Correct 53 ms 86220 KB Output is correct
61 Correct 57 ms 94364 KB Output is correct
62 Correct 96 ms 155648 KB Output is correct
63 Correct 103 ms 156308 KB Output is correct
64 Correct 96 ms 149608 KB Output is correct
65 Correct 101 ms 155228 KB Output is correct
66 Correct 92 ms 149568 KB Output is correct
67 Correct 105 ms 154364 KB Output is correct
68 Correct 89 ms 150224 KB Output is correct
69 Correct 95 ms 150088 KB Output is correct
70 Correct 98 ms 152272 KB Output is correct
71 Correct 59 ms 88832 KB Output is correct
72 Correct 7 ms 15828 KB Output is correct
73 Correct 53 ms 86640 KB Output is correct
74 Correct 57 ms 85680 KB Output is correct
75 Correct 54 ms 88480 KB Output is correct
76 Correct 55 ms 84256 KB Output is correct
77 Correct 52 ms 87236 KB Output is correct
78 Correct 56 ms 94380 KB Output is correct
79 Correct 58 ms 90756 KB Output is correct
80 Correct 54 ms 86180 KB Output is correct
81 Correct 56 ms 94468 KB Output is correct
82 Correct 97 ms 155724 KB Output is correct
83 Correct 98 ms 156360 KB Output is correct
84 Correct 95 ms 149680 KB Output is correct
85 Correct 104 ms 155248 KB Output is correct
86 Correct 92 ms 149532 KB Output is correct
87 Correct 93 ms 154316 KB Output is correct
88 Correct 88 ms 150200 KB Output is correct
89 Correct 93 ms 150092 KB Output is correct
90 Correct 98 ms 152268 KB Output is correct
91 Correct 53 ms 88908 KB Output is correct
92 Correct 7 ms 15800 KB Output is correct
93 Correct 52 ms 86576 KB Output is correct
94 Correct 54 ms 85596 KB Output is correct
95 Correct 54 ms 88576 KB Output is correct
96 Correct 50 ms 84184 KB Output is correct
97 Correct 51 ms 87200 KB Output is correct
98 Correct 61 ms 94436 KB Output is correct
99 Correct 57 ms 90864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 93332 KB Output is correct
2 Correct 95 ms 150128 KB Output is correct
3 Correct 90 ms 154352 KB Output is correct
4 Correct 106 ms 153604 KB Output is correct
5 Correct 99 ms 149324 KB Output is correct
6 Correct 92 ms 153896 KB Output is correct
7 Correct 95 ms 155844 KB Output is correct
8 Correct 100 ms 149964 KB Output is correct
9 Correct 100 ms 154316 KB Output is correct
10 Correct 99 ms 156424 KB Output is correct
11 Correct 55 ms 86112 KB Output is correct
12 Correct 7 ms 16176 KB Output is correct
13 Correct 62 ms 97200 KB Output is correct
14 Correct 56 ms 88908 KB Output is correct
15 Correct 59 ms 97996 KB Output is correct
16 Correct 57 ms 93268 KB Output is correct
17 Correct 61 ms 100944 KB Output is correct
18 Correct 63 ms 100892 KB Output is correct
19 Correct 58 ms 86276 KB Output is correct
20 Correct 56 ms 86804 KB Output is correct
21 Correct 58 ms 93376 KB Output is correct
22 Correct 97 ms 150240 KB Output is correct
23 Correct 95 ms 154244 KB Output is correct
24 Correct 97 ms 153548 KB Output is correct
25 Correct 94 ms 149324 KB Output is correct
26 Correct 92 ms 153908 KB Output is correct
27 Correct 101 ms 155800 KB Output is correct
28 Correct 92 ms 149944 KB Output is correct
29 Correct 96 ms 154312 KB Output is correct
30 Correct 101 ms 156340 KB Output is correct
31 Correct 56 ms 86120 KB Output is correct
32 Correct 7 ms 16212 KB Output is correct
33 Correct 66 ms 97120 KB Output is correct
34 Correct 58 ms 88936 KB Output is correct
35 Correct 59 ms 98040 KB Output is correct
36 Correct 57 ms 93388 KB Output is correct
37 Correct 61 ms 100928 KB Output is correct
38 Correct 61 ms 100976 KB Output is correct
39 Correct 55 ms 86316 KB Output is correct
40 Correct 56 ms 86708 KB Output is correct
41 Correct 57 ms 93372 KB Output is correct
42 Correct 89 ms 150172 KB Output is correct
43 Correct 91 ms 154316 KB Output is correct
44 Correct 103 ms 153548 KB Output is correct
45 Correct 94 ms 149312 KB Output is correct
46 Correct 90 ms 153956 KB Output is correct
47 Correct 93 ms 155840 KB Output is correct
48 Correct 90 ms 149888 KB Output is correct
49 Correct 96 ms 154284 KB Output is correct
50 Correct 103 ms 156412 KB Output is correct
51 Correct 55 ms 86100 KB Output is correct
52 Correct 7 ms 16212 KB Output is correct
53 Correct 67 ms 97116 KB Output is correct
54 Correct 56 ms 88964 KB Output is correct
55 Correct 60 ms 98080 KB Output is correct
56 Correct 57 ms 93352 KB Output is correct
57 Correct 65 ms 100912 KB Output is correct
58 Correct 61 ms 100896 KB Output is correct
59 Correct 55 ms 86288 KB Output is correct
60 Correct 56 ms 86732 KB Output is correct
61 Correct 59 ms 93356 KB Output is correct
62 Correct 94 ms 150108 KB Output is correct
63 Correct 95 ms 154348 KB Output is correct
64 Correct 99 ms 153536 KB Output is correct
65 Correct 94 ms 149240 KB Output is correct
66 Correct 93 ms 153916 KB Output is correct
67 Correct 92 ms 155728 KB Output is correct
68 Correct 95 ms 149908 KB Output is correct
69 Correct 95 ms 154296 KB Output is correct
70 Correct 112 ms 156392 KB Output is correct
71 Correct 56 ms 86132 KB Output is correct
72 Correct 7 ms 16212 KB Output is correct
73 Correct 64 ms 97156 KB Output is correct
74 Correct 62 ms 89052 KB Output is correct
75 Correct 58 ms 98000 KB Output is correct
76 Correct 57 ms 93268 KB Output is correct
77 Correct 64 ms 100852 KB Output is correct
78 Correct 60 ms 100940 KB Output is correct
79 Correct 56 ms 86252 KB Output is correct
80 Correct 65 ms 86792 KB Output is correct
81 Correct 56 ms 93256 KB Output is correct
82 Correct 90 ms 150136 KB Output is correct
83 Correct 90 ms 154332 KB Output is correct
84 Correct 104 ms 153580 KB Output is correct
85 Correct 94 ms 149324 KB Output is correct
86 Correct 101 ms 154012 KB Output is correct
87 Correct 94 ms 155760 KB Output is correct
88 Correct 90 ms 149928 KB Output is correct
89 Correct 98 ms 154312 KB Output is correct
90 Correct 100 ms 156384 KB Output is correct
91 Correct 61 ms 86072 KB Output is correct
92 Correct 7 ms 16212 KB Output is correct
93 Correct 62 ms 97104 KB Output is correct
94 Correct 57 ms 88968 KB Output is correct
95 Correct 60 ms 98084 KB Output is correct
96 Correct 57 ms 93292 KB Output is correct
97 Correct 66 ms 100920 KB Output is correct
98 Correct 62 ms 100976 KB Output is correct
99 Correct 58 ms 86280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -