제출 #255822

#제출 시각아이디문제언어결과실행 시간메모리
255822jainbot27Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> // #include <molecules.h> using namespace std; using ll = long long; // u - l >= wmax - wmin // what does this mean for me vector<int> find_subset(int l, int u, vector<int> w){ vector<int> ret; vector<pair<int, int>> ww; int n = w.size(); for(int i =0; i < n; i++){ ww.push_back({w[i], i}); } sort(ww.begin(), ww.end()); if(ww[0].first >= l && ww[0].first<= u){ ret.push_back(ww[0].second); return ret; } int z = 0; ll sum = ww[0].first; for(int i =1; i < n; i++){ sum += ww[i].first; while(sum > u && z < n){ sum -= ww[z].first; z++; } if(sum >= l && sum <= u){ for(int j = z; j <= i; j++){ ret.push_back(ww[j].second); } return ret; } } return ret; } int main(){ int l = 15; int u = 20; vector<int> w = {7, 8, 12, 12}; vector<int> ret = find_subset(l, u, w); for(int x : ret){ cout << x << " "; } cout << endl; }

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

/tmp/ccFXJ47s.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccNAH9U3.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status