답안 #673222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673222 2022-12-20T00:27:20 Z ThegeekKnight16 Jelly Flavours (IOI20_jelly) C++14
33 / 100
120 ms 156492 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 (rand() % 2) {
    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 14 ms 29164 KB Output is correct
2 Correct 19 ms 36384 KB Output is correct
3 Correct 10 ms 21460 KB Output is correct
4 Correct 15 ms 23900 KB Output is correct
5 Correct 50 ms 69092 KB Output is correct
6 Correct 47 ms 83980 KB Output is correct
7 Correct 46 ms 81524 KB Output is correct
8 Correct 13 ms 28628 KB Output is correct
9 Correct 54 ms 85840 KB Output is correct
10 Correct 25 ms 44628 KB Output is correct
11 Correct 40 ms 77360 KB Output is correct
12 Correct 34 ms 64100 KB Output is correct
13 Correct 31 ms 57948 KB Output is correct
14 Correct 16 ms 29268 KB Output is correct
15 Correct 49 ms 64460 KB Output is correct
16 Correct 36 ms 62132 KB Output is correct
17 Correct 36 ms 64740 KB Output is correct
18 Correct 38 ms 68268 KB Output is correct
19 Correct 35 ms 57300 KB Output is correct
20 Correct 18 ms 29164 KB Output is correct
21 Correct 15 ms 29140 KB Output is correct
22 Correct 20 ms 36436 KB Output is correct
23 Correct 10 ms 21460 KB Output is correct
24 Correct 12 ms 23936 KB Output is correct
25 Correct 42 ms 69064 KB Output is correct
26 Correct 50 ms 83932 KB Output is correct
27 Correct 45 ms 81552 KB Output is correct
28 Correct 16 ms 28656 KB Output is correct
29 Correct 55 ms 85836 KB Output is correct
30 Correct 29 ms 44632 KB Output is correct
31 Correct 44 ms 77412 KB Output is correct
32 Correct 33 ms 64096 KB Output is correct
33 Correct 32 ms 57928 KB Output is correct
34 Correct 15 ms 29216 KB Output is correct
35 Correct 39 ms 64504 KB Output is correct
36 Correct 35 ms 62240 KB Output is correct
37 Correct 44 ms 64720 KB Output is correct
38 Correct 44 ms 68276 KB Output is correct
39 Correct 36 ms 57356 KB Output is correct
40 Correct 17 ms 29140 KB Output is correct
41 Correct 15 ms 29140 KB Output is correct
42 Correct 19 ms 36436 KB Output is correct
43 Correct 10 ms 21468 KB Output is correct
44 Correct 12 ms 23892 KB Output is correct
45 Correct 41 ms 69072 KB Output is correct
46 Correct 50 ms 83980 KB Output is correct
47 Correct 44 ms 81632 KB Output is correct
48 Correct 14 ms 28632 KB Output is correct
49 Correct 53 ms 85852 KB Output is correct
50 Correct 26 ms 44648 KB Output is correct
51 Correct 46 ms 77404 KB Output is correct
52 Correct 33 ms 64080 KB Output is correct
53 Correct 32 ms 57840 KB Output is correct
54 Correct 16 ms 29208 KB Output is correct
55 Correct 42 ms 64516 KB Output is correct
56 Correct 36 ms 62132 KB Output is correct
57 Correct 34 ms 64716 KB Output is correct
58 Correct 36 ms 68320 KB Output is correct
59 Correct 35 ms 57392 KB Output is correct
60 Correct 20 ms 29176 KB Output is correct
61 Correct 16 ms 29092 KB Output is correct
62 Correct 21 ms 36436 KB Output is correct
63 Correct 11 ms 21588 KB Output is correct
64 Correct 12 ms 23852 KB Output is correct
65 Correct 43 ms 69068 KB Output is correct
66 Correct 46 ms 83876 KB Output is correct
67 Correct 44 ms 81612 KB Output is correct
68 Correct 14 ms 28628 KB Output is correct
69 Correct 54 ms 85812 KB Output is correct
70 Correct 26 ms 44544 KB Output is correct
71 Correct 43 ms 77392 KB Output is correct
72 Correct 34 ms 64164 KB Output is correct
73 Correct 34 ms 57856 KB Output is correct
74 Correct 16 ms 29228 KB Output is correct
75 Correct 39 ms 64536 KB Output is correct
76 Correct 35 ms 62140 KB Output is correct
77 Correct 39 ms 64744 KB Output is correct
78 Correct 45 ms 68288 KB Output is correct
79 Correct 41 ms 57280 KB Output is correct
80 Correct 16 ms 29228 KB Output is correct
81 Correct 15 ms 29140 KB Output is correct
82 Correct 19 ms 36432 KB Output is correct
83 Correct 10 ms 21452 KB Output is correct
84 Correct 12 ms 23812 KB Output is correct
85 Correct 43 ms 69164 KB Output is correct
86 Correct 45 ms 83896 KB Output is correct
87 Correct 44 ms 81520 KB Output is correct
88 Correct 14 ms 28628 KB Output is correct
89 Correct 55 ms 85872 KB Output is correct
90 Correct 27 ms 44608 KB Output is correct
91 Correct 42 ms 77448 KB Output is correct
92 Correct 36 ms 64112 KB Output is correct
93 Correct 31 ms 57872 KB Output is correct
94 Correct 15 ms 29268 KB Output is correct
95 Correct 40 ms 64460 KB Output is correct
96 Correct 34 ms 62108 KB Output is correct
97 Correct 36 ms 64720 KB Output is correct
98 Correct 36 ms 68252 KB Output is correct
99 Correct 38 ms 57292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 94356 KB Output is correct
2 Correct 91 ms 155728 KB Output is correct
3 Correct 101 ms 156268 KB Output is correct
4 Correct 105 ms 149712 KB Output is correct
5 Correct 100 ms 155176 KB Output is correct
6 Correct 96 ms 149564 KB Output is correct
7 Correct 90 ms 154332 KB Output is correct
8 Correct 100 ms 150168 KB Output is correct
9 Correct 110 ms 150272 KB Output is correct
10 Correct 90 ms 152264 KB Output is correct
11 Correct 51 ms 88780 KB Output is correct
12 Correct 8 ms 15812 KB Output is correct
13 Correct 53 ms 86620 KB Output is correct
14 Correct 56 ms 85676 KB Output is correct
15 Correct 60 ms 88560 KB Output is correct
16 Correct 55 ms 84248 KB Output is correct
17 Correct 49 ms 87224 KB Output is correct
18 Correct 55 ms 94352 KB Output is correct
19 Correct 58 ms 90844 KB Output is correct
20 Correct 55 ms 86220 KB Output is correct
21 Correct 55 ms 94412 KB Output is correct
22 Correct 99 ms 155792 KB Output is correct
23 Correct 90 ms 156332 KB Output is correct
24 Correct 89 ms 149692 KB Output is correct
25 Correct 96 ms 155232 KB Output is correct
26 Correct 120 ms 149468 KB Output is correct
27 Correct 98 ms 154308 KB Output is correct
28 Correct 94 ms 150204 KB Output is correct
29 Correct 92 ms 150072 KB Output is correct
30 Correct 91 ms 152208 KB Output is correct
31 Correct 51 ms 88844 KB Output is correct
32 Correct 7 ms 15828 KB Output is correct
33 Correct 56 ms 86672 KB Output is correct
34 Correct 56 ms 85672 KB Output is correct
35 Correct 60 ms 88536 KB Output is correct
36 Correct 48 ms 84184 KB Output is correct
37 Correct 51 ms 87244 KB Output is correct
38 Correct 57 ms 94392 KB Output is correct
39 Correct 63 ms 90908 KB Output is correct
40 Correct 55 ms 86164 KB Output is correct
41 Correct 57 ms 94348 KB Output is correct
42 Correct 92 ms 155620 KB Output is correct
43 Correct 104 ms 156340 KB Output is correct
44 Correct 89 ms 149708 KB Output is correct
45 Correct 101 ms 155200 KB Output is correct
46 Correct 92 ms 149548 KB Output is correct
47 Correct 92 ms 154316 KB Output is correct
48 Correct 86 ms 150224 KB Output is correct
49 Correct 95 ms 150092 KB Output is correct
50 Correct 101 ms 152292 KB Output is correct
51 Correct 51 ms 88876 KB Output is correct
52 Correct 6 ms 15828 KB Output is correct
53 Correct 53 ms 86616 KB Output is correct
54 Correct 57 ms 85708 KB Output is correct
55 Correct 60 ms 88572 KB Output is correct
56 Correct 49 ms 84148 KB Output is correct
57 Correct 51 ms 87112 KB Output is correct
58 Correct 65 ms 94284 KB Output is correct
59 Correct 58 ms 90724 KB Output is correct
60 Correct 53 ms 86188 KB Output is correct
61 Correct 58 ms 94380 KB Output is correct
62 Correct 100 ms 155708 KB Output is correct
63 Correct 100 ms 156432 KB Output is correct
64 Correct 103 ms 149692 KB Output is correct
65 Correct 100 ms 155244 KB Output is correct
66 Correct 91 ms 149548 KB Output is correct
67 Correct 91 ms 154308 KB Output is correct
68 Correct 92 ms 150220 KB Output is correct
69 Correct 94 ms 150176 KB Output is correct
70 Correct 97 ms 152232 KB Output is correct
71 Correct 51 ms 88776 KB Output is correct
72 Correct 6 ms 15856 KB Output is correct
73 Correct 51 ms 86548 KB Output is correct
74 Correct 68 ms 85600 KB Output is correct
75 Correct 60 ms 88496 KB Output is correct
76 Correct 48 ms 84212 KB Output is correct
77 Correct 51 ms 87156 KB Output is correct
78 Correct 54 ms 94280 KB Output is correct
79 Correct 59 ms 90828 KB Output is correct
80 Correct 61 ms 86272 KB Output is correct
81 Correct 55 ms 94372 KB Output is correct
82 Correct 103 ms 155724 KB Output is correct
83 Correct 95 ms 156308 KB Output is correct
84 Correct 89 ms 149708 KB Output is correct
85 Correct 101 ms 155292 KB Output is correct
86 Correct 100 ms 149500 KB Output is correct
87 Correct 91 ms 154316 KB Output is correct
88 Correct 88 ms 150212 KB Output is correct
89 Correct 99 ms 150152 KB Output is correct
90 Correct 102 ms 152344 KB Output is correct
91 Correct 66 ms 88828 KB Output is correct
92 Correct 7 ms 15828 KB Output is correct
93 Correct 54 ms 86540 KB Output is correct
94 Correct 57 ms 85588 KB Output is correct
95 Correct 59 ms 88496 KB Output is correct
96 Correct 48 ms 84192 KB Output is correct
97 Correct 52 ms 87228 KB Output is correct
98 Correct 61 ms 94324 KB Output is correct
99 Correct 61 ms 90776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 93324 KB Output is correct
2 Correct 88 ms 150112 KB Output is correct
3 Correct 89 ms 154320 KB Output is correct
4 Correct 107 ms 153632 KB Output is correct
5 Correct 93 ms 149268 KB Output is correct
6 Correct 90 ms 153852 KB Output is correct
7 Correct 90 ms 155772 KB Output is correct
8 Correct 101 ms 149856 KB Output is correct
9 Correct 97 ms 154300 KB Output is correct
10 Correct 98 ms 156356 KB Output is correct
11 Correct 56 ms 86128 KB Output is correct
12 Correct 8 ms 16212 KB Output is correct
13 Correct 62 ms 97180 KB Output is correct
14 Correct 59 ms 88976 KB Output is correct
15 Correct 63 ms 98084 KB Output is correct
16 Correct 60 ms 93332 KB Output is correct
17 Correct 62 ms 100868 KB Output is correct
18 Correct 64 ms 100884 KB Output is correct
19 Correct 60 ms 86288 KB Output is correct
20 Correct 58 ms 86736 KB Output is correct
21 Correct 58 ms 93260 KB Output is correct
22 Correct 92 ms 150092 KB Output is correct
23 Correct 91 ms 154332 KB Output is correct
24 Correct 94 ms 153520 KB Output is correct
25 Correct 95 ms 149284 KB Output is correct
26 Correct 90 ms 153836 KB Output is correct
27 Correct 105 ms 155724 KB Output is correct
28 Correct 100 ms 149892 KB Output is correct
29 Correct 94 ms 154296 KB Output is correct
30 Correct 100 ms 156420 KB Output is correct
31 Correct 58 ms 86104 KB Output is correct
32 Correct 7 ms 16212 KB Output is correct
33 Correct 70 ms 97092 KB Output is correct
34 Correct 59 ms 88912 KB Output is correct
35 Correct 64 ms 97996 KB Output is correct
36 Correct 58 ms 93348 KB Output is correct
37 Correct 65 ms 100916 KB Output is correct
38 Correct 62 ms 100940 KB Output is correct
39 Correct 58 ms 86316 KB Output is correct
40 Correct 59 ms 86744 KB Output is correct
41 Correct 57 ms 93324 KB Output is correct
42 Correct 88 ms 150152 KB Output is correct
43 Correct 91 ms 154288 KB Output is correct
44 Correct 95 ms 153548 KB Output is correct
45 Correct 105 ms 149404 KB Output is correct
46 Correct 104 ms 153896 KB Output is correct
47 Correct 93 ms 155728 KB Output is correct
48 Correct 91 ms 149836 KB Output is correct
49 Correct 93 ms 154328 KB Output is correct
50 Correct 106 ms 156360 KB Output is correct
51 Correct 55 ms 86080 KB Output is correct
52 Correct 6 ms 16212 KB Output is correct
53 Correct 77 ms 97200 KB Output is correct
54 Correct 60 ms 88916 KB Output is correct
55 Correct 60 ms 97984 KB Output is correct
56 Correct 67 ms 93336 KB Output is correct
57 Correct 70 ms 100928 KB Output is correct
58 Correct 70 ms 100956 KB Output is correct
59 Correct 69 ms 86320 KB Output is correct
60 Correct 57 ms 86740 KB Output is correct
61 Correct 57 ms 93336 KB Output is correct
62 Correct 88 ms 150152 KB Output is correct
63 Correct 89 ms 154336 KB Output is correct
64 Correct 93 ms 153520 KB Output is correct
65 Correct 96 ms 149312 KB Output is correct
66 Correct 103 ms 153912 KB Output is correct
67 Correct 101 ms 155820 KB Output is correct
68 Correct 90 ms 149868 KB Output is correct
69 Correct 95 ms 154216 KB Output is correct
70 Correct 106 ms 156364 KB Output is correct
71 Correct 59 ms 86028 KB Output is correct
72 Correct 7 ms 16212 KB Output is correct
73 Correct 63 ms 97104 KB Output is correct
74 Correct 57 ms 88908 KB Output is correct
75 Correct 60 ms 98044 KB Output is correct
76 Correct 59 ms 93316 KB Output is correct
77 Correct 62 ms 100864 KB Output is correct
78 Correct 65 ms 100936 KB Output is correct
79 Correct 58 ms 86300 KB Output is correct
80 Correct 57 ms 86668 KB Output is correct
81 Correct 57 ms 93252 KB Output is correct
82 Correct 87 ms 150184 KB Output is correct
83 Correct 100 ms 154368 KB Output is correct
84 Correct 105 ms 153532 KB Output is correct
85 Correct 93 ms 149196 KB Output is correct
86 Correct 89 ms 153948 KB Output is correct
87 Correct 91 ms 155728 KB Output is correct
88 Correct 89 ms 149940 KB Output is correct
89 Correct 113 ms 154324 KB Output is correct
90 Correct 99 ms 156492 KB Output is correct
91 Correct 59 ms 86060 KB Output is correct
92 Correct 7 ms 16212 KB Output is correct
93 Correct 62 ms 97164 KB Output is correct
94 Correct 58 ms 88976 KB Output is correct
95 Correct 64 ms 98068 KB Output is correct
96 Correct 69 ms 93276 KB Output is correct
97 Correct 63 ms 100892 KB Output is correct
98 Correct 64 ms 101092 KB Output is correct
99 Correct 58 ms 86212 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 -