답안 #949590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949590 2024-03-19T11:41:46 Z tnun Jelly Flavours (IOI20_jelly) C++14
0 / 100
57 ms 78420 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
pair<int,int> c[2005];
int dp[2005][10005];
int find_maximum_unique(int x, int y,vector<int> a,vector<int> b){
	int sz=a.size();
	int ans=0;
	for(int i=0;i<sz;i++){
		c[i+1]=mp(a[i],b[i]);
	}
	sort(c+1,c+sz+1);
	for(int i=1;i<=sz;i++){
		int uld=10005;
		for(int j=0;j<=x;j++){
			dp[i][j]=dp[i-1][j]+c[i].second;
			if(j>=c[i].first){
				dp[i][j]=min(dp[i][j],dp[i][j-c[i].first]);
			}
			uld=min(uld,dp[i][j]);
		}
		uld=y-uld;
		int cnt=i;
		vector<int> temp;
		for(int k=i+1;k<=sz;k++){
			temp.pb(c[k].second);
		}
		sort(temp.begin(),temp.end());
		for(int k=0;k<temp.size();k++){
			if(uld>=temp[k]){
				uld-=temp[k];
				cnt++;
			}
		}
		ans=max(cnt,ans);
		
	}
	return ans;
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int k=0;k<temp.size();k++){
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB 1st lines differ - on the 1st token, expected: '8', found: '9'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB 1st lines differ - on the 1st token, expected: '8', found: '9'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 78420 KB 1st lines differ - on the 1st token, expected: '689', found: '1949'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 46 ms 76372 KB 1st lines differ - on the 1st token, expected: '62', found: '1936'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 57 ms 78416 KB 1st lines differ - on the 1st token, expected: '154', found: '1959'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB 1st lines differ - on the 1st token, expected: '8', found: '9'
2 Halted 0 ms 0 KB -