Submission #317939

# Submission time Handle Problem Language Result Execution time Memory
317939 2020-10-30T23:05:13 Z nickmet2004 Carnival Tickets (IOI20_tickets) C++14
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
#include "tickets.h"
using namespace std;
int cnt[1505];
int n , m ,k;
vector<vector<int>>a;

long long find_maximum(int k , vector<vector<int>> a){
    int n = a.size() , m = a[0].size();
    /// nk/2 maximums - nk/2 minimums
    priority_queue<pair<int , int>> pq;
    long long ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < k; ++j) ans += a[i][m - j + k] ,pq.emplace(-a[i][j] - a[i][m - k + j] , i);
    }
    for(int i = 0; i < n * k / 2; ++i){
        auto x = pq.top(); pq.pop();
        cnt[x.second]++;
        ans += x.first;
    }
    vector<vector<int>> r(n , vector<int>(m , -1));
    for(int i = 0; i < n; ++i){
        int x = 0;
        for(int j = 0; j < cnt[i]; ++j) r[i][j] = x++;
        x %= k;
        for(int j = m - k + cnt[i]; j < m; ++j)r[i][j] = x++;
    }
    allocate_tickets(r);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 298620960 but the tickets gives a total value of -984845544
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Contestant returned 860858182 but the tickets gives a total value of -215204756
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 2 but the tickets gives a total value of 128
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Contestant returned 5 but the tickets gives a total value of 110
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant returned 5 but the tickets gives a total value of 110
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant returned 5 but the tickets gives a total value of 110
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 298620960 but the tickets gives a total value of -984845544
2 Halted 0 ms 0 KB -