제출 #931511

#제출 시각아이디문제언어결과실행 시간메모리
931511beaboss카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
0 ms0 KiB
// Source: https://oj.uz/problem/view/IOI20_tickets // #include "tickets.h" #include "bits/stdc++.h" using namespace std; #define s second #define f first #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<pii> vpii; typedef vector<int> vi; #define FOR(i, a, b) for (int i = (a); i<b; i++) bool ckmin(int& a, int b){ return b < a ? a = b, true : false; } bool ckmax(int& a, int b){ return b > a ? a = b, true : false; } // void allocate_tickets(vector<vi> s) { // // for (auto val: s) { // // for (auto j : val) cout << j << ' '; // // cout << endl; // // } // } int find_maximum(int k, vector<vi> x) { int n = x.size(); int m = x[0].size(); vi state(n, m - k); // stores range of indices for larger half vi start(n, 0); int res = 0; priority_queue<pii> q; FOR(i, 0, n) { FOR(j, m-k, m) res += x[i][j]; q.push( {-x[i][state[i]] - x[i][start[i]], i}); } FOR(i, 0, k * n / 2) { int cur = q.top().s; res += q.top().f; q.pop(); state[cur]++; start[cur]++; if (state[cur] != m) q.push( {-x[i][state[i]] - x[i][start[i]], i}); } vector<vi> final(n, vi(m, -1)); int round = 0; FOR(i, 0, n) { FOR(j, 0, start[i]) { final[i][j] = round; round++; } } FOR(i, 0, n) { set<int> vals; FOR(i, 0, k) vals.insert(i); for (auto val: final[i]) if (val != -1) vals.erase(val); FOR(j, state[i], m) { final[i][j] = *vals.begin(); vals.erase(vals.begin()); } } allocate_tickets(final); return res; } // int main() { // // ios::sync_with_stdio(false); // // cin.tie(nullptr); // // int res = find_maximum(2, {{0, 2, 5}, {1, 1, 3}}); // // cout << res << endl; // }

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp:35:5: error: ambiguating new declaration of 'int find_maximum(int, std::vector<std::vector<int> >)'
   35 | int find_maximum(int k, vector<vi> x) {
      |     ^~~~~~~~~~~~
In file included from tickets.cpp:4:
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);
      |           ^~~~~~~~~~~~