Submission #307457

#TimeUsernameProblemLanguageResultExecution timeMemory
307457nicolaalexandraCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms800 KiB
#include <bits/stdc++.h> #include "tickets.h" #define DIM 2000 using namespace std; int n,m; int f[DIM]; long long find_maximum (int k, vector<vector<int> > x){ n = x.size(), m = x[0].size(); int i; vector <pair<int,int> > v; vector <vector<int> > ans; ans.resize(n); for (i=0;i<n;i++) ans[i].resize(m,-1); for (i=0;i<n;i++) v.push_back(make_pair(x[i][0],i)); sort (v.begin(),v.end()); long long sum = 0, mid; for (i=0;i<n/2;i++){ sum -= v[i].first; f[v[i].second] = 1; ans[v[i].second][0] = 0; mid = v[i].first; } for (i=0;i<n;i++) if (!f[i]){ sum += x[i].back(); ans[i][m-1] = 0; } allocate_tickets(ans); return sum; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:24:24: warning: variable 'mid' set but not used [-Wunused-but-set-variable]
   24 |     long long sum = 0, mid;
      |                        ^~~
#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...