This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 ma,mb;
int maxi(int x, int y, std::vector<int> a, std::vector<int> b,int nodo,int r){
if((nodo==a.size() )|| (x<ma && y<mb) ||(r==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 maxi(x,y,a,b,nodo+1,r);
}
}
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int n = a.size();
ma=1e9;
mb=1e9;
for(int i=0;i<n;i++){
if(a[i]<ma)ma=a[i];
if(b[i]<mb)mb=b[i];
}
return maxi(x,y,a,b,0,0);
}
Compilation message (stderr)
jelly.cpp: In function 'int maxi(int, int, std::vector<int>, std::vector<int>, int, int)':
jelly.cpp:17:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | if((nodo==a.size() )|| (x<ma && y<mb) ||(r==a.size())){
| ~~~~^~~~~~~~~~
jelly.cpp:17:44: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | if((nodo==a.size() )|| (x<ma && y<mb) ||(r==a.size())){
| ~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |