Submission #777361

#TimeUsernameProblemLanguageResultExecution timeMemory
777361_martynasCarnival Tickets (IOI20_tickets)C++14
11 / 100
1 ms596 KiB
#include "tickets.h" #include <vector> #include <cmath> #include <algorithm> using namespace std; #define PB push_back using ll = long long; long long find_maximum(int k, vector<vector<int>> x) { /* sample interaction int n = x.size(); int m = x[0].size(); vector<vector<int>> answer; for (int i = 0; i < n; i++) { vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); return 1; */ int n = x.size(); int m = x[0].size(); vector<vector<int>> answer(n, vector<int>(m, -1)); if(m == 1) { // subtask 1 (only a single way to pick everything) vector<int> A; for(int i = 0; i < n; i++) { A.PB(x[i][0]); answer[i][0] = 0; } sort(A.begin(), A.end()); ll sum = 0; for(int a : A) { sum += abs(a-A[n/2]); } allocate_tickets(answer); return sum; } else if(k == 1) { // subtask 2 } allocate_tickets(answer); return -1; }
#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...