Submission #955038

# Submission time Handle Problem Language Result Execution time Memory
955038 2024-03-29T08:27:46 Z Trisanu_Das Carnival Tickets (IOI20_tickets) C++17
0 / 100
3 ms 604 KB
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
 
long long find_maximum(int k, vector<vector<int> > x) {
  int n = x.size(), m = x[0].size();
  vector<vector<int> > ans(n, vector<int>(m, -1));
  if(k == 1){
    long long sum = 0;
    priority_queue<pair<long long, long long>,  vector<pair<long long, long long> >, greater<pair<long long, long long> > > pq;
    for(int i = 0; i < n; i++){
      sum += x[i][m - 1];
      pq.push({x[i][0] + x[i][m - 1], i});
    }
    for(int i = 0; i < n; i++){
      if(i < n / 2){
        sum -= pq.top().first;
        ans[pq.top().second][0] = 0;
      }else ans[pq.top().second][m - 1] = 0;
    }
    allocate_tickets(ans);
    return sum;
  }
}

Compilation message

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:7:49: warning: control reaches end of non-void function [-Wreturn-type]
    7 |   vector<vector<int> > ans(n, vector<int>(m, -1));
      |                                                 ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB There is no ticket of color 1 on day 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB There is multiple tickets of color 0 on day 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB There is no ticket of color 1 on day 0
2 Halted 0 ms 0 KB -