Submission #297843

# Submission time Handle Problem Language Result Execution time Memory
297843 2020-09-12T04:49:13 Z Dovran Detecting Molecules (IOI16_molecules) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define N 1000009
#define pii pair <int, int>
#define ff first
#define sz() size()
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int c[N], a[N], n;
vector<int>ans;

int find_subset(int l, int r, vector<int> v){
	n=v.sz();
	c[0]=1;
	for(int i=0; i<n; i++){
		for(int j=r; j>=0; j--)
			if(c[j])
				c[j+v[i]]=1, a[j+v[i]]=i;
	}
	for(int i=l; i<=r; i++){
		if(c[i]){
			int x;
			int y=i, in=0;
			while(y>0)
				x=a[y], ans.pb(x), y-=v[x];
			
			break;
		}
	}
	return ans;
}

Compilation message

molecules.cpp: In function 'int find_subset(int, int, std::vector<int>)':
molecules.cpp:26:13: warning: unused variable 'in' [-Wunused-variable]
   26 |    int y=i, in=0;
      |             ^~
molecules.cpp:33:9: error: cannot convert 'std::vector<int>' to 'int' in return
   33 |  return ans;
      |         ^~~