답안 #986144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
986144 2024-05-19T21:39:45 Z Sofiatpc Jelly Flavours (IOI20_jelly) C++14
0 / 100
2000 ms 133876 KB
#include "jelly.h"
#include <bits/stdc++.h>
 
using namespace std;
 
const int MAXN = 2005, MAX = 1e4+5;
int dp[MAXN][MAX], dp2[MAXN][MAX];
 
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
	int n = a.size();
 
	sort(a.begin(),a.end());
	int ans = 0; 
	for(int i = 0; i <= n; i++){

		for(int k = 0; k <= x; k++)dp[i+1][k] = 0;
		for(int j = i; j >= 1; j--)
			for(int k = 0; k <= x; k++){
				if(k < a[j-1])dp[j][k] = dp[j+1][k]+b[j-1];
				else dp[j][k] = min(dp[j+1][k]+b[j-1], dp[j+1][k-a[j-1]]);
			}

		if(y < dp[1][x])continue;
		int r = y - dp[1][x];

		for(int j = n; j >= i+1; j--)
			for(int k = 0; k <= r; k++){
				if(k < b[j-1])dp2[j][k] = dp2[j+1][k];
				else dp2[j][k] = max(dp2[j+1][k], dp2[j+1][k-b[j-1]]+1);
			}
		ans = max(i+dp2[i+1][r], ans);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2036 ms 133876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2060 ms 99428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2025 ms 99152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -