답안 #673238

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673238 2022-12-20T01:46:31 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
0 / 100
18 ms 21204 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;
 
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
#define fr first
#define sc second

const int MAX = 2005;
const int INF = 0x3f3f3f3f;
 
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b){
	int n = a.size();
	
	vector<pair<int, int>> aux;

	for(int i = 0; i < n; i++)
		aux.emplace_back(a[i], b[i]);

	sort(aux.begin(), aux.end());

	vector<vector<pair<int, int>>> dp(n + 1, vector<pair<int, int>>(y + 1));

	dp[0][0] = {0, x};

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

	int ans = 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].sc >= a[i - 1])
				dp[i][j].fr++, dp[i][j].sc -= a[i - 1];

			if(j >= b[i - 1]){
				pair<int, int> cur = dp[i - 1][j - b[i - 1]]; cur.fr++;
				dp[i][j] = max(dp[i][j], cur);
			}

			ans = max(ans, dp[i][j].fr);
		}
	}
 
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB 1st lines differ - on the 1st token, expected: '689', found: '648'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 21204 KB 1st lines differ - on the 1st token, expected: '62', found: '12'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 16900 KB 1st lines differ - on the 1st token, expected: '154', found: '63'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -