Submission #433722

# Submission time Handle Problem Language Result Execution time Memory
433722 2021-06-20T09:55:51 Z SAAD Carnival Tickets (IOI20_tickets) C++17
11 / 100
2 ms 688 KB
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include "tickets.h"
using namespace std;

long long find_maximum(int k, vector<vector<int>> x) {
    vector<vector<int>> x1(x.size()) ;
    long long s = 0 ;
    int sum = 0;
    for (int i = 0; i < x.size(); i++) {
        sum += x[i][0];
        x1[i].push_back(0);
    }
    sort(x.begin(),x.end());
    sum = x[x.size()/2][0] + x[x.size() / 2 - 1][0];
    sum /= 2;
    s = 0;
      for (int i = 0; i < x.size(); i++)
          s += abs(x[i][0] - sum);
    allocate_tickets(x1);
    return s ;
}

Compilation message

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i < x.size(); i++) {
      |                     ~~^~~~~~~~~~
tickets.cpp:21:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |       for (int i = 0; i < x.size(); i++)
      |                       ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 688 KB Output is correct
7 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
8 Halted 0 ms 0 KB -