Submission #922731

#TimeUsernameProblemLanguageResultExecution timeMemory
922731Alihan_8Carnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms604 KiB
#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)); i64 ans = 0; for ( auto &x: t ){ ans += abs(x - t[n / 2]); } return ans; } }

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...