제출 #1125353

#제출 시각아이디문제언어결과실행 시간메모리
1125353VVUU메기 농장 (IOI22_fish)C++20
컴파일 에러
0 ms0 KiB
#include "fish.h" #include<bits/stdc++.h> using namespace std; long long max_weights(long long n, long long m, vector<long long > x, vector<long long > y, vector<long long > w){ vector<vector<pair<long long , long long > > > p; vector<vector<vector<long long > > > dp; vector<vector<long long > > pre; vector<long long > ans; p.resize(n+10); dp.resize(n+10); ans.resize(n+10); pre.resize(n+10); for(long long i=0; i<=n; i++) p[i].push_back(make_pair(0, 0)); for(long long i=0; i<m; i++) p[x[i]].push_back(make_pair(y[i], w[i])); for(long long i=1; i<=n; i++) for(long long i=1; i<=n; i++) for(long long i=1; i<=n; i++){ sort(p[i].begin(), p[i].end()); dp[i].resize(p[i].size(), vector<long long >(5)); pre[i].resize(p[i].size()); for(long long j=1; j<p[i].size(); j++) pre[i][j]+=pre[i][j-1]+p[i][j].second; } for(long long i=2; i<=n; i++){ dp[i][0][0]=dp[i-1][0][0]; long long L=p[i-1].size(); long long val=dp[i-1][L][0]+pre[i].back(); for(long long j=pre[i].size()-1; j>=0; j--){ while(L && p[i-1][L-1].first>p[i][j].first){ L--; val=max(val, dp[i-1][L][0]+pre[i][j]); } if(j) dp[i][j][3]=max(dp[i][j][3], val-pre[i][j-1]); else dp[i][j][3]=max(dp[i][j][3], val); } dp[i][0][0]=max(dp[i][0][0], dp[i][0][3]); long long D=0; val=-1e18; for(long long j=1; j<p[i].size(); j++){ dp[i][j][1]=dp[i-1][0][0]; while(D+1<p[i-1].size() && p[i-1][D+1].first<p[i][j].first){ D++; val=max(val, dp[i-1][D][2]-pre[i-1][D-1]); } dp[i][j][2]=max(dp[i][j][2], max(val, ans[i-2])+pre[i-1][D]); } ans[i]=dp[i][0][0]; for(long long j=1; j<p[i].size(); j++){ dp[i][j][0]=max(dp[i][j][1], max(dp[i][j][2], dp[i][j][3])); ans[i]=max(ans[i], dp[i][j][0]); } } return ans[n]; } //signed main(){ // return 0; //}

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

/usr/bin/ld: /tmp/cc7VSmug.o: in function `main':
grader.cpp:(.text.startup+0x267): 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