제출 #849699

#제출 시각아이디문제언어결과실행 시간메모리
849699chilengamingDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "molecules.h" #define int long long using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; vector<pair<int, int>> ww; int i = 0; for(int &a : w) { ww.push_back({a, i}); i++; } sort(ww.begin(), ww.end()); int R = 0, sum = w[0]; for(int L = 0; L < w.size(); L++) { while(sum < l && R < w.size() - 1) { R++; sum += w[R]; } if(sum >= l && sum <= u) { for(int j = L; j <= R; j++) { ans.push_back(ww[j].second); } return ans; } sum -= w[L]; } 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:18:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int L = 0; L < w.size(); L++) {
      |                    ~~^~~~~~~~~~
molecules.cpp:19:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while(sum < l && R < w.size() - 1) {
      |                          ~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccqmIdpT.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