제출 #650471

#제출 시각아이디문제언어결과실행 시간메모리
650471Markomafko972Detecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define pii pair<int, int> typedef long long ll; using namespace std; const int MOD = 1e9 + 7; const ll INF = 1e18; const int OFF = (1 << 20); vector<int> find_subset(ll l, ll u, vector<ll> w) { vector<int> sol; vector< pair<ll, int> > v; for (int i = 0; i < w.size(); i++) { v.push_back({w[i], i}); } sort(v.begin(), v.end()); ll zbr = 0; for (int i = 0; i < v.size(); i++) { zbr += v[i].X; sol.push_back(v[i].Y); if (zbr >= l && zbr <= u) break; if (zbr > u) { reverse(sol.begin(), sol.end()); zbr -= w[sol.back()]; sol.pop_back(); if (zbr < l || zbr > u) assert(0); break; } } sort(sol.begin(), sol.end()); return sol; }

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

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