# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
983698 |
2024-05-15T23:52:30 Z |
mmk |
Jelly Flavours (IOI20_jelly) |
C++14 |
|
2000 ms |
15188 KB |
#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
const int MAXM = 1e4 + 10;
int dp[MAXN][MAXM];
int calc(int i, int x, int y, int N, vector<int> &a, vector<int> &b)
{
if(y < 0) return -1;
if(x < 0) return calc(i + 1,0,y,N,a,b);
if(dp[i][y] != 0) return dp[i][y];
if(i > N) return 0;
int op1 = calc(i + 1, x - a[i - 1], y, N, a, b) + 1;
int op2 = calc(i + 1, x, y - b[i - 1], N , a, b) + 1;
dp[i][y] = max(op1,op2);
cerr << dp[i][y] << " " << i << " " << y << "\n";
return dp[i][y];
}
bool cmp(pair<int,int> a, pair<int,int> b)
{
if(a.first == b.first) return a.second < b.second;
return a.first < b.first;
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int N = a.size();
vector<pair<int,int>> aux;
for(int i = 0; i < N; i++)
aux.push_back({a[i],b[i]});
sort(aux.begin(),aux.end(),cmp);
int comp = 0;
int novo = N;
for(int i = 0; i < N; i++)
{
if(aux[i].first == 0 || aux[i].second == 0)
{
comp++;
novo--;
continue;
}
a[i] = aux[i].first;
b[i] = aux[i].second;
// cerr << a[i] << " " << b[i] << "\n";
}
N = novo;
return calc(1,x,y,N,a,b) + comp;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '7', found: '9' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '7', found: '9' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
5972 KB |
1st lines differ - on the 1st token, expected: '689', found: '1337' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
12484 KB |
1st lines differ - on the 1st token, expected: '62', found: '999' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2054 ms |
15188 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 1st token, expected: '7', found: '9' |
3 |
Halted |
0 ms |
0 KB |
- |