제출 #72935

#제출 시각아이디문제언어결과실행 시간메모리
72935FedericoSDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <algorithm>
#include "molecules.h"
using namespace std;
typedef long long int ll;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {

	vector<ll> V;
	ll N=w.size();
	ll S=0;
	vector<pair<ll,ll>> W;

	for(ll i=0;i<N;i++)
		W.push_back({w[i],i});
	sort(W.begin(), W.end());

    for(ll a=0,b=0;a<N;a++){
    	S-=a?W[a-1].first:0;
    	while(l>S and b<N)
    		S+=W[b++].first;
    	if(l<=S and S<=u){
    		for(ll i=a;i<b;i++)
    			V.push_back(W[i].second);
    		return V;
    	}
    }

    return V;

}

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:24:14: error: could not convert 'V' from 'std::vector<long long int>' to 'std::vector<int>'
       return V;
              ^
molecules.cpp:28:12: error: could not convert 'V' from 'std::vector<long long int>' to 'std::vector<int>'
     return V;
            ^