Submission #673754

# Submission time Handle Problem Language Result Execution time Memory
673754 2022-12-22T00:10:10 Z mmk Jelly Flavours (IOI20_jelly) C++17
0 / 100
107 ms 155756 KB
#include <bits/stdc++.h>
#include "jelly.h"
#define fr first
#define sc second
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 2e3+10;
const int MAXX = 1e4+10;
struct jelly
{
	int a,b;
};
jelly val[MAXN];
bool cmp(jelly p, jelly q)
{
	return p.a < q.a;
}
pair<int,int> dp[MAXN][MAXX];
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
{
	int n = a.size();
	for(int i = 1; i <= n; i++)
	{
		val[i].a = a[i-1];
		val[i].b = b[i-1];
 	}
 	sort(val+1,val+(n+1),cmp);
	dp[0][0] = {0,x};
	for(int i = 1; i <= y; i++)
		dp[0][i] = {-1,-1};
	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].sc >= val[i].a)
			{
				dp[i][j].fr++;
				dp[i][j].sc -= val[i].a;
			}
			if(j >= val[i].b)
			{
				pair<int,int> aux = dp[i][j-val[i].b];
				aux.fr++;
				if(aux.fr > dp[i][j].fr || (aux.fr == dp[i][j].fr && aux.sc > dp[i][j].sc))
					dp[i][j] = aux;
			}
			resp = max(resp,dp[i][j].fr);
		}
	}
	return resp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '30'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '30'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 8404 KB 1st lines differ - on the 1st token, expected: '689', found: '700'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 29032 KB Output is correct
2 Correct 92 ms 155756 KB Output is correct
3 Correct 94 ms 148840 KB Output is correct
4 Incorrect 107 ms 149736 KB 1st lines differ - on the 1st token, expected: '1906', found: '3797'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 24916 KB 1st lines differ - on the 1st token, expected: '154', found: '686'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB 1st lines differ - on the 1st token, expected: '8', found: '30'
2 Halted 0 ms 0 KB -