Submission #397726

#TimeUsernameProblemLanguageResultExecution timeMemory
397726leinad2Carnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms692 KiB
#include"tickets.h" #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:14:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(i=0;i<v.size();i++)
      |             ~^~~~~~~~~
tickets.cpp:16:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         if(2*i<v.size())ans-=v[i];
      |            ~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...