Submission #400147

#TimeUsernameProblemLanguageResultExecution timeMemory
400147priority_queueCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
// ioi 2020, day 1, supertrees #include <bits/stdc++.h> using namespace std; #define forint(i, N) for (int i = 0; i < (N); i++) using namespace std; void allocate_tickets(vector< vector<long long> > s); long long find_maximum(int k, vector< vector<long long> > x) { int n = x.size(); int m = x[0].size(); vector< vector<int> > s(n, vector<int>(m, -1)); vector<int> min_index(n, 0); vector<int> max_index(n, m-1); vector<pair<long long, int>> increase(n); long long total = 0; forint(i, k) { forint(j, n) { increase[j].first = x[j][min_index[j]] + x[j][max_index[j]]; increase[j].second = j; } nth_element(increase.begin(), increase.begin() + n/2, increase.end()); // first half is negative for (int j = 0; j < n/2; j++) { total -= x[increase[j].second][min_index[increase[j].second]]; s[increase[j].second][min_index[increase[j].second]] = i; min_index[increase[j].second]++; } // second half is positive for (int j = n/2; j < n; j++) { total += x[increase[j].second][max_index[increase[j].second]]; s[increase[j].second][max_index[increase[j].second]] = i; max_index[increase[j].second]--; } //cerr << total << "--" << endl; } allocate_tickets(s); return total; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<long long int> >)':
tickets.cpp:52:19: error: could not convert 's' from 'vector<vector<int>>' to 'vector<vector<long long int>>'
   52 |  allocate_tickets(s);
      |                   ^
      |                   |
      |                   vector<vector<int>>