Submission #300847

#TimeUsernameProblemLanguageResultExecution timeMemory
300847faustaadpCarnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms768 KiB
#include "tickets.h" #include <vector> #include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define fi first #define se second ll n, m, k, has; std::vector<std::vector<int>> answer; std::vector<std::vector<int>> x; void sub1() { vector<ll> tmp; for(ll i = 0; i < n; i++) { answer[i][0] = 0; tmp.pb(x[i][0]); } sort(tmp.begin(), tmp.end()); for(ll i = 0; i < n; i++) if(i < (n / 2)) has -= tmp[i]; else has += tmp[i]; } long long find_maximum(int tk, std::vector<std::vector<int>> tx) { k = tk; x = tx; n = x.size(); m = x[0].size(); for (int i = 0; i < n; i++) { std::vector<int> row(m); for (int j = 0; j < m; j++) { row[j] = -1; } answer.push_back(row); } if(m == 1) sub1(); allocate_tickets(answer); return has; }
#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...