Submission #827534

#TimeUsernameProblemLanguageResultExecution timeMemory
827534minhcool카니발 티켓 (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#define local
#ifndef local
#include "tickets.h"
#endif
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef pair<ii, ii> iiii;

const ll N = 3e5 + 5;

const ll oo = 1e18 + 7, mod = 1e9 + 7;

mt19937 rng(1);

ll rnd(ll l, ll r){
	ll temp = rng() % (r - l + 1);
	return abs(temp) + l;
}

ll n, m, itr[N];

ll find_maximum(int k, vector<vector<int>> x){
    n = x.size(), m = x[0].size();
    ll sum = 0;
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        for(ll j = 0; j < k; j++) ans += x[i][m - j - 1];
        itr[i] = 0;
    }
    priority_queue<ii, vector<ii>> pq;
    for(ll i = 0; i < n; i++) pq.push({-(x[i][0] + x[i][m - k]), i});
    for(ll i = 1; i <= (n * k)/2; i++){
        ii temp = pq.top();
        pq.pop();
        itr[temp.se]++;
        ans += temp.fi;
        if(itr[temp.se] < k) pq.push({-(x[temp.se][itr[temp.se]] + x[i][m - k + itr[temp.se]]), temp.se});
    }
    vector<vector<int> assign;
    assign.resize(n);
    for(ll i = 0; i < n; i++){
        assign[i].resize(m);
        for(ll j = 0; j < m; j++) assign[i][j] = -1;
        ll cnt = 0;
        for(ll j = 0; j < itr[i]; j++){
            assign[i][j] = cnt;
            cnt++;
        }
        for(ll j = itr[i]; j < k; j++){
            assign[i][m - k + j] = cnt;
            cnt++;
        }
    }
    allocate_tickets(assign);
    return sum;
}

#ifdef local
void process(){

}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll t;
	cin >> t;
	while(t--) process();
}
#endif

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:50:24: error: template argument 1 is invalid
   50 |     vector<vector<int> assign;
      |                        ^~~~~~
tickets.cpp:50:24: error: template argument 2 is invalid
tickets.cpp:51:5: error: 'assign' was not declared in this scope; did you mean 'asin'?
   51 |     assign.resize(n);
      |     ^~~~~~
      |     asin
tickets.cpp:65:5: error: 'allocate_tickets' was not declared in this scope
   65 |     allocate_tickets(assign);
      |     ^~~~~~~~~~~~~~~~