제출 #1002110

#제출 시각아이디문제언어결과실행 시간메모리
1002110rahidilbayramliDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> #pragma GCC optimize("-O3") #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define f first #define s second #define pb push_back #define p_b pop_back using namespace std; vl find_subset(ll l, ll u, vl w) { ll f = min(l, u); ll g = max(l, u); l = f, u = g; vl ans; vector<pll>vect; vect.pb({0, 0}); for(ll i = 0; i < w.size(); i++) vect.pb({w[i] * 1LL, i}); sort(all(vect)); ll n = w.size(), i; ll pref[n+5]; pref[0] = 0LL; for(i = 1; i <= n; i++) pref[i] = pref[i-1] * 1LL + vect[i].f * 1LL; //for(i = 1; i <= n; i++) //cout << pref[i]<< "\n"; for(i = 1; i <= n; i++) { ll lo = i, hi = n; //cout << "i: " << i << "\n"; while(lo <= hi) { ll mid = (lo + hi) / 2; ll sum = pref[mid] * 1LL - pref[i-1] * 1LL; //cout << "mid: " << mid << " sum: " << sum << "\n"; if(sum > u) hi = mid - 1; else if(sum < l) lo = mid + 1; else if(l <= sum && sum <= u) { for(ll j = i; j <= mid; j++) ans.pb(vect[j].s); return ans; } } } 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:24:21: 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]
   24 |     for(ll i = 0; i < w.size(); i++)
      |                   ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccBirrM9.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