Submission #998164

#TimeUsernameProblemLanguageResultExecution timeMemory
998164ArapakCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms872 KiB
// Author: Kajetan Ramsza #include "bits/stdc++.h" #include "tickets.h" using namespace std; #define rep(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; template<typename F, typename S> ostream& operator<<(ostream& os, const pair<F, S> &p) { return os<<"("<<p.first<<", "<<p.second<<")"; } template<typename T> ostream &operator<<(ostream & os, const vector<T> &v) { os << "{"; typename vector< T > :: const_iterator it; for( it = v.begin(); it != v.end(); it++ ) { if( it != v.begin() ) os << ", "; os << *it; } return os << "}"; } void dbg_out() { cerr<<'\n'; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr<<' '<<H; dbg_out(T...); } #ifdef DEBUG #define dbg(...) cerr<<"(" << #__VA_ARGS__ <<"):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif int n, m, k; vector<vi> answer; vector<vector<ll>> tickets; ll find_maximum(int k_, vector<vi> tickets_) { k = k_; n = tickets_.size(); m = tickets_[0].size(); tickets.assign(n, vector<ll>(m)); rep(i,0,n) rep(j,0,m) tickets[i][j] = tickets_[i][j]; answer.assign(n, vi(m, -1)); vi vals(n); rep(i,0,n) { vals[i] = tickets[i][0]; rep(j,0,m) { if (j < k) { answer[i][j] = j; } else { answer[i][j] = -1; } } } allocate_tickets(answer); sort(all(vals)); ll res = 0; rep(i,0,n) res += vals[i] * (i < n/2 ? -1 : 1); return res; }
#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...