제출 #302709

#제출 시각아이디문제언어결과실행 시간메모리
302709Dovran카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "tickets.h" #define N 2009 #define pii pair <int, int> #define ff first #define sz() size() #define ss second #define pb push_back #define ll long long using namespace std; int n, m, ans; pii c[N]; vector<pii> p; int s[N][N]; int k; ll find_maximum(int g, vector<vector<int>>v){ k=g; n=v.sz(); m=v[0].sz(); for(int i=0; i<n ;i++) c[i]={0, m-1}; while(k){ p.empty(); for(int i=0; i<n; i++) p.pb({v[i][c[i].ff]+v[i][c[i].ss], i}); sort(p.begin(), p.end()); int x=0, y=0; for(int i=0; i<n; i++){ int in=p[i].ss; if(i<n/2) x+=v[in][c[in].ff], s[in][c[in].ff]=k, c[in].ff++; else y+=v[in][c[in].ss], s[in][c[in].ss]=k, c[in].ss++; } ans+=y-x; k--; } for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ if(s[i][j]==0) s[i][j]=-1; else s[i][j]=g-s[i][j]; } } allocate_tickets(s); return ans; } /* int main(){ int k; vector<vector<int>>v; int x, y, z; cin>>x>>y>>k; v.resize(x); for(int i=0; i<x; i++) for(int j=0; j<y; j++) cin>>z, v[i].pb(z); cout<<find_maximum(k, v); }*/

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:50:19: error: could not convert '(int (*)[2009])(& s)' from 'int (*)[2009]' to 'std::vector<std::vector<int> >'
   50 |  allocate_tickets(s);
      |                   ^
      |                   |
      |                   int (*)[2009]