Submission #673215

# Submission time Handle Problem Language Result Execution time Memory
673215 2022-12-20T00:04:38 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
9 / 100
69 ms 94340 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);
    }
  }

  int i = n, j = x;

  while (i != 0) {
    if (dp[i][j] == dp[i - 1][j])
      i--;
    else if (dp[i][j] == dp[i - 1][j - a[i]] + 1) {
      i--, 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]);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '9', found: '10'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '9', found: '10'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 29196 KB Output is correct
2 Correct 19 ms 36384 KB Output is correct
3 Correct 9 ms 21460 KB Output is correct
4 Correct 12 ms 23816 KB Output is correct
5 Correct 43 ms 69072 KB Output is correct
6 Correct 45 ms 83984 KB Output is correct
7 Correct 44 ms 81612 KB Output is correct
8 Correct 14 ms 28684 KB Output is correct
9 Correct 58 ms 85832 KB Output is correct
10 Correct 25 ms 44596 KB Output is correct
11 Correct 40 ms 77404 KB Output is correct
12 Correct 34 ms 64052 KB Output is correct
13 Correct 30 ms 57868 KB Output is correct
14 Correct 16 ms 29308 KB Output is correct
15 Correct 43 ms 64488 KB Output is correct
16 Correct 34 ms 62196 KB Output is correct
17 Correct 35 ms 64808 KB Output is correct
18 Correct 36 ms 68328 KB Output is correct
19 Correct 36 ms 57348 KB Output is correct
20 Correct 16 ms 29232 KB Output is correct
21 Correct 14 ms 29124 KB Output is correct
22 Correct 19 ms 36404 KB Output is correct
23 Correct 10 ms 21460 KB Output is correct
24 Correct 12 ms 23880 KB Output is correct
25 Correct 42 ms 69140 KB Output is correct
26 Correct 45 ms 83968 KB Output is correct
27 Correct 52 ms 81648 KB Output is correct
28 Correct 14 ms 28628 KB Output is correct
29 Correct 54 ms 85884 KB Output is correct
30 Correct 29 ms 44604 KB Output is correct
31 Correct 40 ms 77376 KB Output is correct
32 Correct 34 ms 64076 KB Output is correct
33 Correct 32 ms 57972 KB Output is correct
34 Correct 16 ms 29268 KB Output is correct
35 Correct 39 ms 64436 KB Output is correct
36 Correct 32 ms 62164 KB Output is correct
37 Correct 35 ms 64728 KB Output is correct
38 Correct 37 ms 68264 KB Output is correct
39 Correct 35 ms 57404 KB Output is correct
40 Correct 16 ms 29268 KB Output is correct
41 Correct 14 ms 29220 KB Output is correct
42 Correct 19 ms 36496 KB Output is correct
43 Correct 10 ms 21460 KB Output is correct
44 Correct 12 ms 23892 KB Output is correct
45 Correct 42 ms 69096 KB Output is correct
46 Correct 45 ms 83916 KB Output is correct
47 Correct 43 ms 81596 KB Output is correct
48 Correct 14 ms 28628 KB Output is correct
49 Correct 53 ms 85824 KB Output is correct
50 Correct 25 ms 44624 KB Output is correct
51 Correct 41 ms 77372 KB Output is correct
52 Correct 34 ms 64152 KB Output is correct
53 Correct 37 ms 57852 KB Output is correct
54 Correct 17 ms 29268 KB Output is correct
55 Correct 40 ms 64460 KB Output is correct
56 Correct 38 ms 62124 KB Output is correct
57 Correct 34 ms 64820 KB Output is correct
58 Correct 36 ms 68260 KB Output is correct
59 Correct 34 ms 57300 KB Output is correct
60 Correct 16 ms 29168 KB Output is correct
61 Correct 16 ms 29152 KB Output is correct
62 Correct 19 ms 36436 KB Output is correct
63 Correct 10 ms 21460 KB Output is correct
64 Correct 12 ms 23892 KB Output is correct
65 Correct 43 ms 69176 KB Output is correct
66 Correct 53 ms 83916 KB Output is correct
67 Correct 45 ms 81600 KB Output is correct
68 Correct 15 ms 28628 KB Output is correct
69 Correct 69 ms 85836 KB Output is correct
70 Correct 27 ms 44620 KB Output is correct
71 Correct 47 ms 77388 KB Output is correct
72 Correct 36 ms 64100 KB Output is correct
73 Correct 31 ms 57872 KB Output is correct
74 Correct 16 ms 29240 KB Output is correct
75 Correct 40 ms 64468 KB Output is correct
76 Correct 33 ms 62156 KB Output is correct
77 Correct 34 ms 64792 KB Output is correct
78 Correct 41 ms 68324 KB Output is correct
79 Correct 36 ms 57388 KB Output is correct
80 Correct 18 ms 29260 KB Output is correct
81 Correct 15 ms 29140 KB Output is correct
82 Correct 19 ms 36456 KB Output is correct
83 Correct 10 ms 21544 KB Output is correct
84 Correct 15 ms 23928 KB Output is correct
85 Correct 43 ms 69068 KB Output is correct
86 Correct 45 ms 83860 KB Output is correct
87 Correct 44 ms 81568 KB Output is correct
88 Correct 16 ms 28756 KB Output is correct
89 Correct 54 ms 85836 KB Output is correct
90 Correct 26 ms 44628 KB Output is correct
91 Correct 41 ms 77460 KB Output is correct
92 Correct 34 ms 64084 KB Output is correct
93 Correct 32 ms 57852 KB Output is correct
94 Correct 16 ms 29268 KB Output is correct
95 Correct 41 ms 64516 KB Output is correct
96 Correct 35 ms 62200 KB Output is correct
97 Correct 35 ms 64768 KB Output is correct
98 Correct 37 ms 68296 KB Output is correct
99 Correct 34 ms 57292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 94340 KB 1st lines differ - on the 1st token, expected: '62', found: '61'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 93260 KB 1st lines differ - on the 1st token, expected: '154', found: '155'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '9', found: '10'
6 Halted 0 ms 0 KB -