답안 #406454

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406454 2021-05-17T15:36:47 Z victoriad Jelly Flavours (IOI20_jelly) C++14
0 / 100
2000 ms 31500 KB
#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();
      |      ^
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2072 ms 5936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2051 ms 30848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2053 ms 31500 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -