Submission #539278

#TimeUsernameProblemLanguageResultExecution timeMemory
539278MohamedFaresNebiliCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "tickets.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;
        using vi = vector<int>;
        using db = double;

        #define ff first
        #define ss second
        #define pb push_back
        #define all(x) x.begin(), x.end()
        #define lb lower_bound
        #define ub upper_bound

        const ll INF = LONG_LONG_MAX / 2;
        
        int find_maximum(int k, vector<vector<int>> arr) {
            int n = arr.size(), m = arr[0].size();
            int ans[n][m]; vector<int> curr;
            for(int l = 0; l < n; l++)
                for(int i = 0; i < m; i++) 
                    ans[l][i] = 0, curr.pb(arr[l][i]);
            int best = 1000000007;
            for(auto u : curr) {
                int s = 0;
                for(int l = 0; l < n; l++)
                    s += abs(arr[l][0] - u);
                best = min(best, s);
            }
            allocate_tickets(ans);
            return best;
        }

Compilation message (stderr)

tickets.cpp:22:13: error: ambiguating new declaration of 'int find_maximum(int, std::vector<std::vector<int> >)'
   22 |         int find_maximum(int k, vector<vector<int>> arr) {
      |             ^~~~~~~~~~~~
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);
      |           ^~~~~~~~~~~~
tickets.cpp: In function 'int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:35:30: error: could not convert '(int (*)[m])(& ans)' from 'int (*)[m]' to 'std::vector<std::vector<int> >'
   35 |             allocate_tickets(ans);
      |                              ^~~
      |                              |
      |                              int (*)[m]