Submission #1050257

#TimeUsernameProblemLanguageResultExecution timeMemory
1050257mychecksedadCarnival Tickets (IOI20_tickets)C++17
0 / 100
0 ms348 KiB
#include "tickets.h" #include<bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define vi vector<int> #define all(x) x.begin(),x.end() long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); std::vector<std::vector<int>> answer(n, vector<int>(m)); vector<array<int, 3>> a; for(int i = 0; i < n; ++i) for(int j = 0; j < m; ++j) a.pb({x[i][j], i, j}); sort(all(a)); vector<vector<vector<int>>> C(n, vector<vector<int>>(2)); for(int i = 0; i < n*m; ++i){ if(i < n*m/2){ C[a[i][1]][0].pb(a[i][2]); }else{ C[a[i][1]][1].pb(a[i][2]); } } // cout << "f" << endl; for(int i = 0; i < m; ++i){ set<pair<int, int>> S; for(int i = 0; i < n; ++i){ S.insert({C[i][0].size(), i}); } int cur =0 ; auto it = S.begin(); while(it != S.end()){ if(cur < n/2){ int v = (*it).second; answer[v][C[v][1].back()] = i; C[v][1].pop_back(); }else{ int v = (*it).second; answer[v][C[v][0].back()] = i; C[v][0].pop_back(); } ++cur; it = next(it); } // cout << "f" << endl; } // for (int i = 0; i < n; i++) { // std::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; }
#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...