제출 #254462

#제출 시각아이디문제언어결과실행 시간메모리
254462baboDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define L long long using namespace std; int n; L s,e; struct S{ L idx, weight; }; bool operator<(S a,S b){ return a.weight<b.weight; } vector<int> solve(int l,int u, vector<int> w){ n=w.size(); vector<int> ans(n); L i; s=l,e=u; L W=0; vector<S>v; for(i=0;i<n;i++) v.push_back((S){i,w[i]}); sort(v.begin(),v.end()); for(i=n-1;i>=0;i--) { W+=v[i].weight; ans[v[i].idx]=1; if(W>e) { L j=n-1; while(i>0) { W+=v[i-1].weight; ans[v[i-1].idx]=1; W-=v[j].weight; ans[v[j].idx]=0; i--;j--; if(s<=W&&W<=e) return ans; } break; } else if(W>=s) return ans; } vector<int> ans2(n,0); return ans2; }

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

/tmp/ccQgQnrl.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