Submission #673233

# Submission time Handle Problem Language Result Execution time Memory
673233 2022-12-20T01:37:27 Z ThegeekKnight16 Jelly Flavours (IOI20_jelly) C++17
0 / 100
82 ms 157844 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;
struct baba
{
  int escol, dinA;

  baba(int E = 0, int D = 0) {escol = E; dinA = D;}
} dp[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();

  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;
  }

  dp[0][0] = baba(0, 0);
  for (int i = 1; i <= y; i++) dp[0][i] = baba(-INF, -INF);

  int resp = 0;

  for (int i = 1; i <= n; i++)
  {
      for (int j = 0; j <= y; j++)
        {
          dp[i][j] = dp[i-1][j];
          if (dp[i][j].dinA >= a[i])
          {
            dp[i][j].escol++;
            dp[i][j].dinA -= a[i];
          }
          if (j >= b[i])
          {
            baba aux = dp[i-1][j - b[i]];
            aux.escol++;
            if (aux.escol > dp[i][j].escol) dp[i][j] = aux;
            else if (aux.escol == dp[i][j].escol && aux.dinA > dp[i][j].dinA) dp[i][j] = aux;
          }
          resp = max(resp, dp[i][j].escol);
        }
  }

  return resp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 157772 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 157772 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 157804 KB 1st lines differ - on the 1st token, expected: '689', found: '642'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 157844 KB 1st lines differ - on the 1st token, expected: '62', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 82 ms 157784 KB 1st lines differ - on the 1st token, expected: '154', found: '49'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 157772 KB 1st lines differ - on the 1st token, expected: '8', found: '4'
2 Halted 0 ms 0 KB -