이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (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... |