#include "jelly.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <stack>
#include <fstream>
using namespace std;
int maxi(int x, int y, std::vector<int> a, std::vector<int> b,int nodo,int r){
if(nodo==a.size()){
return r;
}
else{
if(a[nodo]<=x && b[nodo]<=y){
return max(maxi(x-a[nodo],y,a,b,nodo+1,r+1),max(maxi(x,y-b[nodo],a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r)));
}
else if(a[nodo]<=x){
return max(maxi(x-a[nodo],y,a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r));
}
else if(b[nodo]<=y){
return max(maxi(x,y-b[nodo],a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r));
}
else{
return r;
}
}
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int n = a.size();
return maxi(x,y,a,b,0,0);
}
Compilation message
jelly.cpp: In function 'int maxi(int, int, std::vector<int>, std::vector<int>, int, int)':
jelly.cpp:16:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | if(nodo==a.size()){
| ~~~~^~~~~~~~~~
jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:35:6: warning: unused variable 'n' [-Wunused-variable]
35 | int n = a.size();
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2072 ms |
5936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2051 ms |
30848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2053 ms |
31500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
4 |
Halted |
0 ms |
0 KB |
- |