Submission #1007468

#TimeUsernameProblemLanguageResultExecution timeMemory
1007468u_suck_oCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms860 KiB
#include "tickets.h" #include "bits/stdc++.h" #define SZ 1505 using namespace std; bool large[SZ][SZ], small[SZ][SZ]; bool used[SZ]; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>> answer = vector<vector<int>>(n, vector<int>(m, -1)); vector<pair<int, pair<int, int>>> v; //{number, {ticket color, ticket id}} for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { v.push_back({x[i][j], {i, j}}); } } sort(v.begin(), v.end()); long long ans = 0; int count = 0; for (int i = v.size()-1; i >= 0; i--) { if (count == n/2) break; if (!used[v[i].second.first]) { ans += v[i].first; answer[v[i].second.first][v[i].second.second] = 0; used[v[i].second.first] = true; count++; } } count = 0; for (int i = 0; i < v.size(); i++) { if (count == n/2) break; if (!used[v[i].second.first]) { ans -= v[i].first; answer[v[i].second.first][v[i].second.second] = 0; used[v[i].second.first] = true; count++; } } allocate_tickets(answer); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:36:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for (int i = 0; i < v.size(); i++) {
      |                     ~~^~~~~~~~~~
#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...