제출 #984181

#제출 시각아이디문제언어결과실행 시간메모리
984181alphagomasterDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define int long long using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> ww) { int n = size(ww); pair<int,int>w[n]; for(int i = 0 ; i < n;i++){ w[i].first = ww[i]; w[i].second=i; } sort(w,w+n); int j = 0; int sum = 0; deque<int>v; for(int i = 0; i < n;i++){ v.push_back(w[i].second); sum += w[i].first; while(sum > u){ sum -= w[j].first; j ++; v.pop_front(); } if(sum >= l && sum <= u){ //cout << i-j+1 << endl; vector<int>out; for(int jj = 0; jj <size(v);jj++){ out.push_back(v[j]); } return out; } } return {0}; }

컴파일 시 표준 에러 (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:28:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |       for(int jj = 0; jj <size(v);jj++){
      |                       ~~~^~~~~~~~
/usr/bin/ld: /tmp/ccJm7Boh.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