Submission #377338

#TimeUsernameProblemLanguageResultExecution timeMemory
377338autumn_eelCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms748 KiB
#include "tickets.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>>answer(n,vector<int>(m)); vector<int>v; rep(i,n){ rep(j,m){ answer[i][j]=0; v.push_back(x[i][j]); } } sort(v.begin(),v.end()); int med=v[v.size()/2]; ll ans=0; rep(i,v.size()){ ans+=abs(v[i]-med); } allocate_tickets(answer); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:4:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define rep(i,n)for(int i=0;i<(n);i++)
      |                              ^
tickets.cpp:26:2: note: in expansion of macro 'rep'
   26 |  rep(i,v.size()){
      |  ^~~
#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...