Submission #1119903

#TimeUsernameProblemLanguageResultExecution timeMemory
1119903dsyzCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms504 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; using ll = long long; #define MAXN (1000005) long long find_maximum(int k, vector<vector<int>> x) { ll N = x.size(); ll M = x[0].size(); vector<ll> all; for(ll i = 0;i < N;i++){ for(ll j = 0;j < N;j++){ all.push_back(x[i][j]); } } sort(all.begin(),all.end()); pair<ll,ll> best = {-1,-1}; for(auto b : all){ ll sum = 0; for(ll i = 0;i < N;i++){ sum += abs(b - x[i][0]); } best = max(best,{sum,b}); } vector<vector<int> > ans; vector<int> row; for(ll i = 0;i < N;i++){ row.push_back(0); } ans.push_back(row); allocate_tickets(ans); return best.first; }

Compilation message (stderr)

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