Submission #1073427

#TimeUsernameProblemLanguageResultExecution timeMemory
1073427blushingecchigirlCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

void allocate_tickets( std::vector<std::vector<int>> _x);
long long find_maximum(int k, std::vector<std::vector<int>> d) {
    int n = d.size();
    vector<int> v;
    for(int i = 0; i<n; i++) {
        v.pb(d[i][0]);
        d[i][0] = 0;
    }
    sort(v.begin(), v.end());
    ll maximum = 0;
    for(int i = 0; i<n; i++) {
        maximum+=abs(v[i]-v[n/2]);
    }
    allocate_tickets(d);
    return maximum;
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:9:11: error: 'class std::vector<int>' has no member named 'pb'
    9 |         v.pb(d[i][0]);
      |           ^~
tickets.cpp:13:5: error: 'll' was not declared in this scope
   13 |     ll maximum = 0;
      |     ^~
tickets.cpp:15:9: error: 'maximum' was not declared in this scope
   15 |         maximum+=abs(v[i]-v[n/2]);
      |         ^~~~~~~
tickets.cpp:18:12: error: 'maximum' was not declared in this scope
   18 |     return maximum;
      |            ^~~~~~~