Submission #199390

# Submission time Handle Problem Language Result Execution time Memory
199390 2020-02-01T07:25:21 Z kshitij_sodani Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
typedef  long long int llo ;

#define mp make_pair
#define pb push_back
#define a first
#define b second
vector<llo> find_subset(llo l,llo u,vector<llo> w){
	llo dp[1001];
	memset(dp,0,sizeof(dp));
	dp[0]=1;
	for(llo j=0;j<w.size();j++){
		for(llo i=1001;i>=w[j];i--){
			if(dp[i-w[j]]!=0 and dp[i]==0){
				dp[i]=j+1;
			}
		}
	}
	llo ind=-1;
	for(llo i=l;i<u+1;i++){
		if(dp[i]>0){
			ind=i;
			break;
		}
	}
	//cout<<ind<<endl;
	//cout<<w[dp[15]]<<endl;
	vector<llo> ans;
	if(ind==-1){
		return ans;
	}
	while(ind>0){
		ans.pb(dp[ind]);
		ind-=w[dp[ind]-1];
	}
	return ans;
}
/*
int main(){

	vector<llo> ss=find_subset(15,17,{6,8,8,7});
	for(int i=0;i<ss.size();i++){
		cout<<ss[i]<<" ";
	}
	cout<<endl;


	return 0;

}*/

Compilation message

molecules.cpp: In function 'std::vector<long long int> find_subset(llo, llo, std::vector<long long int>)':
molecules.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(llo j=0;j<w.size();j++){
              ~^~~~~~~~~
/tmp/cc7ur4Kg.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status