제출 #553220

#제출 시각아이디문제언어결과실행 시간메모리
553220sandry24Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define pb push_back #define mp make_pair #define f first #define s second int find_subset(int l, int u, int w[], int n, int result[]){ sort(w, w+n, greater<int>()); ll sum = 0; int ind = 0; vector<int> visited(n); while(ind != n){ if(sum + w[ind] < l){ sum += w[l]; visited[ind] = 1; } ind++; } for(int i = n-1; i >= 0; i--){ if(!visited[i]){ sum += w[i]; visited[ind] = 1; break; } } if(sum >= l && sum <= u){ int m = 0; for(int i = 0; i < n; i++){ if(visited[i]){ cout << i << ' '; result[i] = w[i]; m++; } } return m; } return 0; } void solve(){ } int main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--){ solve(); } }

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

/usr/bin/ld: /tmp/ccdT7hwR.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccRGN1CP.o:molecules.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccdT7hwR.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