Submission #433667

# Submission time Handle Problem Language Result Execution time Memory
433667 2021-06-20T09:22:50 Z SAAD Carnival Tickets (IOI20_tickets) C++17
0 / 100
1 ms 204 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 sum = 0 , s = 0 ;
    for (int i = 0; i < x.size(); i++) {
        sum += x[i][0];
        x1[i].push_back(0);
    }
    sum /= x.size();
    long long mx = 1e9 ;
    for (int j = max(sum-2, 0LL); j < max(sum-2, 0LL) + 3; j++) {
        s = 0;
        for (int i = 0; i < x.size(); i++) {
            s += abs(x[i][0] - sum);
        }
        mx = min(s,mx);
    }
    allocate_tickets(x1);
    return mx;
}

Compilation message

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (int i = 0; i < x.size(); i++) {
      |                     ~~^~~~~~~~~~
tickets.cpp:20:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for (int i = 0; i < x.size(); i++) {
      |                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Contestant returned 1729378519 but the tickets gives a total value of 1000000000
3 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 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 Incorrect 1 ms 204 KB Contestant returned 1729378519 but the tickets gives a total value of 1000000000
3 Halted 0 ms 0 KB -