답안 #239413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239413 2020-06-15T14:03:25 Z GREGOIRELC Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define int long long

vector<int> find_subset(int l, int u, vector<int> val)
{
	sort(val.begin(), val.end());
	int deb = 0, fin = 0;
	int s = 0;
	while(fin < val.size() && s < l)
	{
		if(s + val[fin] > u)
		{
			s -= val[deb];
			s += val[fin];
			deb++;
			fin++;
		}
		else
		{
			s += val[fin];
			deb++;
			fin++;
		}
	}
	vector<int> result;
	if(s < l || s > u)
	{
		return result;
	}
	for(int i = deb; i < fin; i++)
	{
		result.push_back(val[i]);
	}
	return result;
}

Compilation message

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:14:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(fin < val.size() && s < l)
        ~~~~^~~~~~~~~~~~
/tmp/ccRLs7KW.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