답안 #983696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983696 2024-05-15T23:39:06 Z mmk Jelly Flavours (IOI20_jelly) C++14
24 / 100
123 ms 53876 KB
#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
const int MAXM = 1e4 + 10;

int dp[MAXN][MAXM];

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][y] != 0) return dp[i][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;

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

bool cmp(pair<int,int> a, pair<int,int> b)
{
	if(a.first == b.first) return a.second < b.second;
	return a.first < b.first;
}

int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int N = a.size();
	vector<pair<int,int>> aux;
	for(int i = 0; i < N; i++)
		aux.push_back({a[i],b[i]});

	sort(aux.begin(),aux.end(),cmp);
	int comp = 0;
	int novo = N;
	for(int i = 0; i < N; i++)
	{
		if(aux[i].first == 0 || aux[i].second == 0)
		{
			comp++;
			novo--;
			continue;
		}
		a[i] = aux[i].first;
		b[i] = aux[i].second;
		// cerr << a[i] << " " << b[i] << "\n";
	}
	N = novo;
	return calc(1,x,y,N,a,b) + comp;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '689', found: '648'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 66 ms 34060 KB Output is correct
5 Correct 50 ms 53840 KB Output is correct
6 Correct 1 ms 1368 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 860 KB Output is correct
9 Correct 45 ms 50728 KB Output is correct
10 Correct 36 ms 22112 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 13 ms 9820 KB Output is correct
15 Correct 15 ms 23644 KB Output is correct
16 Correct 1 ms 856 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 9 ms 11356 KB Output is correct
20 Correct 5 ms 7516 KB Output is correct
21 Correct 1 ms 856 KB Output is correct
22 Correct 1 ms 860 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 44 ms 34096 KB Output is correct
25 Correct 52 ms 53840 KB Output is correct
26 Correct 1 ms 1368 KB Output is correct
27 Correct 1 ms 1116 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 51 ms 50772 KB Output is correct
30 Correct 37 ms 22096 KB Output is correct
31 Correct 1 ms 860 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 1116 KB Output is correct
34 Correct 12 ms 9776 KB Output is correct
35 Correct 15 ms 23640 KB Output is correct
36 Correct 1 ms 856 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 1 ms 1116 KB Output is correct
39 Correct 11 ms 11356 KB Output is correct
40 Correct 5 ms 7516 KB Output is correct
41 Correct 1 ms 860 KB Output is correct
42 Correct 2 ms 860 KB Output is correct
43 Correct 1 ms 860 KB Output is correct
44 Correct 45 ms 34220 KB Output is correct
45 Correct 61 ms 53860 KB Output is correct
46 Correct 1 ms 1372 KB Output is correct
47 Correct 1 ms 1112 KB Output is correct
48 Correct 1 ms 860 KB Output is correct
49 Correct 45 ms 50804 KB Output is correct
50 Correct 36 ms 22108 KB Output is correct
51 Correct 1 ms 860 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 1116 KB Output is correct
54 Correct 11 ms 9820 KB Output is correct
55 Correct 16 ms 23644 KB Output is correct
56 Correct 1 ms 856 KB Output is correct
57 Correct 1 ms 604 KB Output is correct
58 Correct 1 ms 1116 KB Output is correct
59 Correct 9 ms 11296 KB Output is correct
60 Correct 5 ms 7512 KB Output is correct
61 Correct 1 ms 860 KB Output is correct
62 Correct 1 ms 860 KB Output is correct
63 Correct 1 ms 860 KB Output is correct
64 Correct 45 ms 34164 KB Output is correct
65 Correct 53 ms 53876 KB Output is correct
66 Correct 2 ms 1372 KB Output is correct
67 Correct 1 ms 1116 KB Output is correct
68 Correct 1 ms 860 KB Output is correct
69 Correct 46 ms 50784 KB Output is correct
70 Correct 36 ms 22096 KB Output is correct
71 Correct 1 ms 856 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 1116 KB Output is correct
74 Correct 11 ms 9936 KB Output is correct
75 Correct 20 ms 23480 KB Output is correct
76 Correct 1 ms 860 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 1116 KB Output is correct
79 Correct 13 ms 11356 KB Output is correct
80 Correct 4 ms 7516 KB Output is correct
81 Correct 1 ms 1056 KB Output is correct
82 Correct 1 ms 860 KB Output is correct
83 Correct 1 ms 860 KB Output is correct
84 Correct 60 ms 34128 KB Output is correct
85 Correct 51 ms 53840 KB Output is correct
86 Correct 1 ms 1368 KB Output is correct
87 Correct 1 ms 1112 KB Output is correct
88 Correct 1 ms 860 KB Output is correct
89 Correct 49 ms 50676 KB Output is correct
90 Correct 54 ms 22100 KB Output is correct
91 Correct 2 ms 860 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 2 ms 1016 KB Output is correct
94 Correct 10 ms 9820 KB Output is correct
95 Correct 27 ms 23520 KB Output is correct
96 Correct 1 ms 860 KB Output is correct
97 Correct 1 ms 600 KB Output is correct
98 Correct 1 ms 1112 KB Output is correct
99 Correct 9 ms 11356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1628 KB Output is correct
2 Correct 5 ms 2140 KB Output is correct
3 Correct 5 ms 1884 KB Output is correct
4 Correct 92 ms 38708 KB Output is correct
5 Correct 95 ms 36512 KB Output is correct
6 Correct 5 ms 2140 KB Output is correct
7 Correct 5 ms 2156 KB Output is correct
8 Correct 5 ms 2140 KB Output is correct
9 Correct 90 ms 37988 KB Output is correct
10 Correct 111 ms 40328 KB Output is correct
11 Correct 2 ms 1624 KB Output is correct
12 Correct 1 ms 444 KB Output is correct
13 Correct 3 ms 1624 KB Output is correct
14 Correct 17 ms 11356 KB Output is correct
15 Correct 38 ms 18516 KB Output is correct
16 Correct 2 ms 1368 KB Output is correct
17 Correct 3 ms 1628 KB Output is correct
18 Correct 3 ms 1372 KB Output is correct
19 Correct 6 ms 8884 KB Output is correct
20 Correct 6 ms 8792 KB Output is correct
21 Correct 3 ms 1624 KB Output is correct
22 Correct 5 ms 2140 KB Output is correct
23 Correct 5 ms 1884 KB Output is correct
24 Correct 93 ms 38696 KB Output is correct
25 Correct 83 ms 36436 KB Output is correct
26 Correct 5 ms 2136 KB Output is correct
27 Correct 5 ms 2140 KB Output is correct
28 Correct 5 ms 2140 KB Output is correct
29 Correct 109 ms 37900 KB Output is correct
30 Correct 123 ms 40272 KB Output is correct
31 Correct 2 ms 1624 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 3 ms 1628 KB Output is correct
34 Correct 19 ms 11356 KB Output is correct
35 Correct 40 ms 18516 KB Output is correct
36 Correct 3 ms 1372 KB Output is correct
37 Correct 3 ms 1480 KB Output is correct
38 Correct 3 ms 1620 KB Output is correct
39 Correct 6 ms 8796 KB Output is correct
40 Correct 6 ms 8796 KB Output is correct
41 Correct 3 ms 1596 KB Output is correct
42 Correct 7 ms 2140 KB Output is correct
43 Correct 5 ms 1872 KB Output is correct
44 Correct 92 ms 38816 KB Output is correct
45 Correct 87 ms 36604 KB Output is correct
46 Correct 5 ms 2140 KB Output is correct
47 Correct 5 ms 2136 KB Output is correct
48 Correct 5 ms 2140 KB Output is correct
49 Correct 89 ms 37876 KB Output is correct
50 Correct 92 ms 40200 KB Output is correct
51 Correct 2 ms 1628 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 3 ms 1628 KB Output is correct
54 Correct 19 ms 11524 KB Output is correct
55 Correct 41 ms 18516 KB Output is correct
56 Correct 3 ms 1368 KB Output is correct
57 Correct 3 ms 1624 KB Output is correct
58 Correct 3 ms 1372 KB Output is correct
59 Correct 6 ms 8796 KB Output is correct
60 Correct 5 ms 8668 KB Output is correct
61 Correct 3 ms 1628 KB Output is correct
62 Correct 6 ms 2168 KB Output is correct
63 Correct 5 ms 1884 KB Output is correct
64 Correct 103 ms 38800 KB Output is correct
65 Correct 94 ms 36392 KB Output is correct
66 Correct 5 ms 2136 KB Output is correct
67 Correct 5 ms 2140 KB Output is correct
68 Correct 5 ms 2140 KB Output is correct
69 Correct 91 ms 37972 KB Output is correct
70 Correct 106 ms 40436 KB Output is correct
71 Correct 2 ms 1628 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 2 ms 1624 KB Output is correct
74 Correct 18 ms 11356 KB Output is correct
75 Correct 44 ms 18376 KB Output is correct
76 Correct 3 ms 1624 KB Output is correct
77 Correct 3 ms 1628 KB Output is correct
78 Correct 3 ms 1480 KB Output is correct
79 Correct 6 ms 8796 KB Output is correct
80 Correct 7 ms 8792 KB Output is correct
81 Correct 2 ms 1628 KB Output is correct
82 Correct 5 ms 2140 KB Output is correct
83 Correct 5 ms 1884 KB Output is correct
84 Correct 91 ms 38612 KB Output is correct
85 Correct 82 ms 36436 KB Output is correct
86 Correct 5 ms 2136 KB Output is correct
87 Correct 5 ms 2140 KB Output is correct
88 Correct 5 ms 2140 KB Output is correct
89 Correct 91 ms 37980 KB Output is correct
90 Correct 101 ms 40220 KB Output is correct
91 Correct 2 ms 1628 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 2 ms 1628 KB Output is correct
94 Correct 17 ms 11356 KB Output is correct
95 Correct 40 ms 18316 KB Output is correct
96 Correct 2 ms 1372 KB Output is correct
97 Correct 3 ms 1628 KB Output is correct
98 Correct 3 ms 1372 KB Output is correct
99 Correct 6 ms 8796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -