Submission #319792

#TimeUsernameProblemLanguageResultExecution timeMemory
319792akobiCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include "tickets.h" #include<bits/stdc++.h> #define ll long long #define F first #define S second #define pb push_back #define mp make_pair using namespace std; ll n,m,anss,c,cc; vector< vector<int> > ans; vector<int> temp; vector<ll> fix; set< pair<ll,ll> >s; pair<ll,ll> t; ll find_maximum(ll k, vector< vector<ll> > x) { n=x.size(); m=x[0].size(); for (int i=0; i<m; i++) temp.pb(-1); for (int i=0; i<n; i++) ans.pb(temp); for (int i=0; i<n; i++) fix.pb(0); for (int i=0; i<n; i++) { for (int j=m-k; j<m; j++) anss+=x[i][j]; s.insert( mp( x[i][0]+x[i][m-k] , i) ); } for (int c=0; c<k*n/2; c++) { t=*s.begin(); s.erase(*s.begin()); anss-=t.F; fix[t.S]++; if (fix[t.S]<k) s.insert( mp( x[t.S][fix[t.S]] + x[t.S][m-k+fix[t.S]] , t.S ) ); } for (int i=0; i<n; i++) { for (int j=0; j<fix[i]; j++) { ans[i][j]=c; c++; c%=k; } cc=c; for (int j=m-k+fix[i]; j<m; j++) { ans[i][j]=cc; cc++; cc%=k; } } allocate_tickets(ans); return anss; }

Compilation message (stderr)

/tmp/ccOcY7Z1.o: In function `main':
grader.cpp:(.text.startup+0x3bf): undefined reference to `find_maximum(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status