Submission #539283

#TimeUsernameProblemLanguageResultExecution timeMemory
539283MohamedFaresNebiliCarnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms296 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;

        long long find_maximum(int k, vector<vector<int>> arr) {
            int n = arr.size(), m = arr[0].size();
            vector<vector<int>> ans(n, vector<int>(m, -1)); 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;
        }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...