제출 #382385

#제출 시각아이디문제언어결과실행 시간메모리
382385TrunktyDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long sum=0;

vector<int> find_subset(long long l, long long u, vector<long long> w){
	sort(w.begin(),w.end());
	long long lef=0,rit=-1;
	while(rit!=w.size()){
		rit++;
		sum += w[rit];
		while(sum>u){
			sum -= w[lef];
			lef++;
		}
		if(sum<=u and sum>=l){
			vector<int> a = {};
			for(int i=lef;i<=rit;i++){
				a.push_back(i);
			}
			return a;
		}
	}
	return {};
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:10:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  while(rit!=w.size()){
      |        ~~~^~~~~~~~~~
/tmp/ccFfHLN0.o: In function `main':
grader.cpp:(.text.startup+0x139): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status