Submission #405123

#TimeUsernameProblemLanguageResultExecution timeMemory
405123ly20Carnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms716 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1512; int resp[MAXN]; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector <int> d1; for(int i = 0; i < n; i++) { d1.push_back(x[i][0]); } sort(d1.begin(), d1.end()); long long md = d1[n/2]; long long resp = 0; for(int i = 0; i < n; i++) { if(d1[i] < md) resp += md - d1[i]; else resp += d1[i] - md; } vector <vector <int> > answer; vector <int> temp; for(int i = 0; i < n; i++) { temp.push_back(0); answer.push_back(temp); temp.clear(); } //answer.push_back(temp); allocate_tickets(answer); return resp; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:9:6: warning: unused variable 'm' [-Wunused-variable]
    9 |  int 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...