제출 #428928

#제출 시각아이디문제언어결과실행 시간메모리
428928LouayFarahDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "molecules.h" using namespace std; #define pb push_back int n, l, u; vector<int> backtrack; vector<int> pre; bool solve(int w[], int i, int curr) { if(curr>=l&&curr<=u) return true; if(curr>u) return false; int temp = 0; if(i==0) temp = curr + pre[n-1]; else temp = curr + pre[n-1]-pre[i-1]; if(temp<l) return false; if(i==n) { return false; } bool flag = false; for(int j = i; j<n; j++) { backtrack.pb(w[j]); flag = solve(w, j+1, curr+w[j]); if(flag) break; backtrack.pop_back(); } return flag; } int find_subset(int L, int U, int W[], int N, int result[]) { n = N; l = L; u = U; pre.assign(n, 0); pre[0] = W[0]; for(int i = 1; i<n; i++) pre[i] = pre[i-1] + W[i]; bool flag = solve(W, 0, 0); if(flag) { int res = (int)backtrack.size(); for(int j = 0; j<res; j++) result[j] = backtrack[j]; return res; } return 0; }

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

/usr/bin/ld: /tmp/ccg4e9E3.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