제출 #834713

#제출 시각아이디문제언어결과실행 시간메모리
834713GordonRemzi007Catfish Farm (IOI22_fish)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #define ll long long using namespace std; ll max_weights(ll n, ll m, vector<ll> x, vector<ll> y, vector<ll> w) { ll res; if(n == 2) { ll r0 = 0, r1 = 0; for(ll i = 0; i < m; i++) { if(x[i]) r1+=w[i]; else r0+=w[i]; } res = max(r0, r1); } else { vector<ll> pref0(n), pref1(n); for(int i = 0; i < m; i++) { if(x[i]) pref1[y[i]] = w[i]; else pref0[y[i]] = w[i]; } for(int i = 1; i < n; i++) { pref0[i]+=pref0[i-1]; pref1[i]+=pref1[i-1]; } res = pref1[n-1]; for(int i = 0; i < n; i++) res = max(res, pref0[i]+pref1[n-1]-pref1[i]); } return res; }

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

/usr/bin/ld: /tmp/cciqGSQs.o: in function `main':
grader.cpp:(.text.startup+0x25e): undefined reference to `max_weights(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status