답안 #983678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983678 2024-05-15T22:54:25 Z mmk Jelly Flavours (IOI20_jelly) C++14
0 / 100
1 ms 348 KB
#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 510;

int dp[MAXN][MAXN][MAXN];

int calc(int i, int x, int y, int N, vector<int> &a, vector<int> &b)
{
	if(x < 0 || y < 0) return -1;
	if(dp[i][x][y] != 0) return dp[i][x][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;
	int op3 = calc(i + 1, x , y , N, a, b);

	dp[i][x][y] = max(max(op1,op2),op3);
	// cerr << dp[i][x][y] << " " << i << " " << x << " " << y << "\n";
	return dp[i][x][y];
}


int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int N = a.size();

	sort(a.begin(),a.end());
	int resp = 0;
	for(int cur : a)
	{
		if(x > y && x - cur >= 0) {x-= cur; resp++;}
		else if(y - cur >= 0) {y -= cur; resp++;}
	}

	return resp;

}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:26:6: warning: unused variable 'N' [-Wunused-variable]
   26 |  int N = a.size();
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '689', found: '58'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '62', found: '64'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '1867', found: '1866'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '5'
2 Halted 0 ms 0 KB -