Submission #922730

# Submission time Handle Problem Language Result Execution time Memory
922730 2024-02-06T04:54:53 Z Alihan_8 Carnival Tickets (IOI20_tickets) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>

#include "tickets.h"

using namespace std;

#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long

using i64 = long long;

template <class F, class _S>
bool chmin(F &u, const _S &v){
    bool flag = false;
    if ( u > v ){
        u = v; flag |= true;
    }
    return flag;
}

template <class F, class _S>
bool chmax(F &u, const _S &v){
    bool flag = false;
    if ( u < v ){
        u = v; flag |= true;
    }
    return flag;
}

long long find_maximum(int k, std::vector<std::vector<int>> a) {
	int n = a.size();
	int m = a[0].size();
    if ( m == 1 ){
        vector <vector<int>> p(n, vector <int> (m));
        allocate_tickets(p);
        vector <int> t;
        for ( auto &x: a ){
            for ( auto &y: x ){
                t.pb(y);
            }
        }
        sort(all(t));
        int ans = 0;
        for ( auto &x: t ){
            ans += abs(x - t[n / 2]);
        }
        return ans;
    }
}

Compilation message

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Contestant returned 18919508441 but the tickets gives a total value of 1739639257
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 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 344 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 0 ms 348 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 0 ms 600 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 0 ms 600 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 348 KB Contestant returned 18919508441 but the tickets gives a total value of 1739639257
5 Halted 0 ms 0 KB -