제출 #319979

#제출 시각아이디문제언어결과실행 시간메모리
319979CursedCodeDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <molecules.h>
using namespace std;

std::vector<int> find_subset(int l, int u,std::vector<int> w){
	vector<pair<int,int>> x;
	for(int i = 0;i<=w.size;i++){
		x.push_back(make_pair(w[i],i));
	}
    sort(x.begin(),x.end());
	int n = x.size();
	int L = 0;
	int R = 0;
	long long sum = 0;
	vector<int> a;
	while(R < n){
		sum += x[R].first;
		while(sum > u && L <= R) sum-= x[L].first, L++;
		if(sum >= l){
			for(int i = L;i <= R;i++) a.push_back(x[i].second);
			break;
		}
	    R++;
	}
	
	return a;
}

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:21: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' (did you forget the '()' ?)
    7 |  for(int i = 0;i<=w.size;i++){
      |                   ~~^~~~
      |                         ()