Submission #622323

#TimeUsernameProblemLanguageResultExecution timeMemory
622323happypotatoCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms696 KiB
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ff first
#define ss second
#define pb push_back
//
const ll MAX = 1e18;
vector<vector<int>> a;
int n, m, k;
ll st1() {
    vector<vector<int>> allo;
    allo.resize(n, {0});
    allocate_tickets(allo);
    vector<ll> shit(n);
    for (int i = 0; i < n; i++) shit[i] = a[i][0];
    sort(shit.begin(), shit.end());
    ll ans = MAX, cur = 0;
    for (int i = 0; i < n; i++) {
        cur += shit[i];
    }
    int delta = -n;
    for (int i = 0; i < n; i++) {
        cur += (shit[i] - (i == 0 ? 0 : shit[i - 1])) * delta;
        ans = min(ans, cur);
        delta += 2;
    }
    return ans;
}
long long find_maximum(int K, vector<vector<int>> x) {
    n = x.size(); m = x[0].size(); k = K; a = x;
    if (m == 1) return st1();
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
#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...