Submission #317934

# Submission time Handle Problem Language Result Execution time Memory
317934 2020-10-30T22:52:49 Z nickmet2004 Carnival Tickets (IOI20_tickets) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define "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:2:9: error: macro names must be identifiers
    2 | #define "tickets.h"
      |         ^~~~~~~~~~~
tickets.cpp: In function 'int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:27:5: error: 'allocate_tickets' was not declared in this scope
   27 |     allocate_tickets(a);
      |     ^~~~~~~~~~~~~~~~