Submission #411061

#TimeUsernameProblemLanguageResultExecution timeMemory
411061eagle30Carnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms716 KiB
#include "tickets.h" #include<bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int> > x) { long long n = x.size(); long long m = x[0].size(); vector<vector<int> > answer; answer.assign(n, vector<int>()); vector<long long> vi; for (long long i = 0; i < n; i++) { answer[i].push_back(0); vi.push_back(x[i][0]); } sort(vi.begin(), vi.end()); long long hi=vi.size(), tot=0; hi/=2; for(long long i=0; i<vi.size(); i++){ tot+=abs(vi[i]-vi[hi]); } allocate_tickets(answer); return tot; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:17:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(long long i=0; i<vi.size(); i++){
      |                     ~^~~~~~~~~~
tickets.cpp:6:12: warning: unused variable 'm' [-Wunused-variable]
    6 |  long long m = x[0].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...