제출 #498274

#제출 시각아이디문제언어결과실행 시간메모리
498274OrazBDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define N 100005 #define ll long long int #define pii pair <long long, long long> #define pb push_back #define ff first #define ss second using namespace std; vector <int> find_subset(ll l, ll u, vector <int> w){ ll sm = 0, tr = 0; vector <pii> v; vector <int> ans; for (int i = 0; i < w.size(); i++) v.pb({w[i], i}); sort (v.begin(), v.end()); for (int i = 0; i < v.size(); i++){ sm += v[i].ff; ans.pb(v[i].ss); if (sm >= l and sm <= u){tr = 1; break;} } if (!tr) ans.clear(); return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<int>)':
molecules.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 0; i < w.size(); i++) v.pb({w[i], i});
      |                  ~~^~~~~~~~~~
molecules.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i = 0; i < v.size(); i++){
      |                  ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccOs3iMr.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