Submission #397725

#TimeUsernameProblemLanguageResultExecution timeMemory
397725leinad2Carnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int> > x) { int n=x.size();int m=x[0].size();int i, j; vector<int>v; for(i=0;i<n;i++) { v.push_back(x[i][0]); } sort(v.begin(), v.end()); long long ans=0; for(i=0;i<v.size();i++) { if(2*i<v.size())ans-=v[i]; else ans+=v[i]; } vector<vector<int> >res; res.resize(n); for(i=0;i<n;i++) { res[i].resize(m); for(j=0;j<m;j++)res[i][j]=-1; } for(i=0;i<n;i++)res[i][0]=0; allocate_tickets(res); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:13:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(i=0;i<v.size();i++)
      |             ~^~~~~~~~~
tickets.cpp:15:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         if(2*i<v.size())ans-=v[i];
      |            ~~~^~~~~~~~~
tickets.cpp:26:5: error: 'allocate_tickets' was not declared in this scope
   26 |     allocate_tickets(res);
      |     ^~~~~~~~~~~~~~~~