제출 #769366

#제출 시각아이디문제언어결과실행 시간메모리
769366Mery2005Detecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h"
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <unordered_map>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <iomanip>
#include <fstream>
 
using namespace std;

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

const long long mod = 1e9+7;
const int N = 3e5+5;
int a[N] , dp[N];

vector<int> find_subset(long long int l, long long int u, vector<int> w){
  int n = w.size();
  vector<pair<int , int>> w1;
  for(int i = 0 ; i < n ; i++){
    w1.push_back({w[i] , i});
  }
  sort(w1.begin() , w1.end());
  int ind = 0;
  long long int s = 0;
  for(int i = 0 ; i < n ; i++){
    while(s < l){
      s += w1[ind].first * 1ll;
      ind++;
    }
    if(s >= l && s <= u){
      vector<int> res;
			for (int j = i; j < ind; j++) {
				res.push_back(w1[j].second);
			}
			return res;
    }
    s -= w1[i].first * 1ll;
  }
  return vector<int>(0);
}

// int main(){
//   vector<int> ans = find_subset(15, 17, {6, 8, 8, 7});
//   for(auto x : ans){
//     cout << x << endl;
//   }
//   return 0;
// }

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

/usr/bin/ld: /tmp/ccS2vFIo.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status