제출 #781337

#제출 시각아이디문제언어결과실행 시간메모리
781337devariaotaDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> #define int long long using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int sz=0; vector<pair<int, int>> a; for(int p : w) a.push_back({p, sz++}); sort(a.begin(), a.end()); int sum=0; int L=0, R=0; while(L<sz) { while(R<sz && sum<l) sum+=a[R++].first; if(l<=sum && sum<=u) { vector<int> ans; for(int i=L; i<R; i++) ans.push_back(i); return ans; } sum-=a[L++].first; if(l<=sum && sum<=u) { vector<int> ans; for(int i=L; i<R; i++) ans.push_back(i); return ans; } } }

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

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:7:26: warning: control reaches end of non-void function [-Wreturn-type]
    7 |   vector<pair<int, int>> a;
      |                          ^
/usr/bin/ld: /tmp/ccP3DFvX.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