제출 #319787

#제출 시각아이디문제언어결과실행 시간메모리
319787akobi카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
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; }

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

tickets.cpp: In function 'long long int find_maximum(long long int, std::vector<std::vector<long long int> >)':
tickets.cpp:56:5: error: 'allocate_tickets' was not declared in this scope
   56 |     allocate_tickets(ans);
      |     ^~~~~~~~~~~~~~~~