Submission #317935

# Submission time Handle Problem Language Result Execution time Memory
317935 2020-10-30T22:53:22 Z nickmet2004 Carnival Tickets (IOI20_tickets) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "tickets.h"
using namespace std;
int cnt[1505];
int n , m ,k;
vector<vector<int>>a;

int find_maximum(int k , vector<vector<int>> a){
    int n = a.size() , m = a[0].size();
    /// nk/2 maximums - nk/2 minimums
    priority_queue<pair<int , int>> pq;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < k; ++j) ans += a[i][m - j - 1] ,pq.emplace(-a[i][j] - a[i][m - k + j] , i);
    }
    for(int i = 0; i < n * k / 2; ++i){
        auto x = pq.top(); pq.pop();
        cnt[x.second]++;
        ans += x.first;
    }
    for(int i = 0; i < n; ++i){
        int x = 0;
        for(int j = 0; j < cnt[i]; ++j) a[i][j] = x++;
        x %= k;
        for(int j = m - k + cnt[i]; j < m; ++j)a[i][j] = x++;
    }
    allocate_tickets(a);
    return ans;
}

Compilation message

tickets.cpp:8:5: error: ambiguating new declaration of 'int find_maximum(int, std::vector<std::vector<int> >)'
    8 | int find_maximum(int k , vector<vector<int>> a){
      |     ^~~~~~~~~~~~
In file included from tickets.cpp:2:
tickets.h:3:11: note: old declaration 'long long int find_maximum(int, std::vector<std::vector<int> >)'
    3 | long long find_maximum(int k, std::vector<std::vector<int>> d);
      |           ^~~~~~~~~~~~