답안 #321844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321844 2020-11-13T12:46:32 Z Pety Jelly Flavours (IOI20_jelly) C++14
0 / 100
29 ms 8812 KB
#include <bits/stdc++.h>
#include "jelly.h"

using namespace std;

int n, m, dp[1002][1002], dp2[1002][1002], mn[1002];

struct meh {
  int a, b, i;
} obj[1002];

bool cmp (meh a, meh b) {
  return a.a < b.a;
}

int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
  int n = a.size();
  int ans = 0;
  for (int i = 0; i < n; i++)
    obj[i + 1] = {a[i], b[i], i};
  sort(obj + 1, obj + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
     mn[i] = 2e9;
    for (int j = 0; j <= x;j++) {
      dp[i][j] = dp[i - 1][j] + obj[i].b;
      if (j >= obj[i].a)
        dp[i][j] = min(dp[i][j], dp[i - 1][j - obj[i].a]);
      mn[i] = min(mn[i], dp[i][j]);
    }
  }
  for (int i = n; i >= 1; i--)
    for (int j = obj[i].b; j <= y; j++)
     dp2[i][j] = min(dp2[i + 1][j], dp2[i][j - obj[i].b] + 1);
  for (int i = 0; i <= n; i++) {
    int cst = y - mn[i];
    if (cst > 0)
      ans = max(ans, i + dp2[i + 1][cst]);
  }
  return ans;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 12 ms 8684 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 28 ms 8812 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 8684 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -