Submission #1012598

#TimeUsernameProblemLanguageResultExecution timeMemory
1012598ProtonDecay314Carnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms860 KiB
/* */ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<bool> vb; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define TCASES int t; cin >> t; while(t--) #ifndef DEBUG #include "tickets.h" #endif #ifdef DEBUG vvi ta; void allocate_tickets(const vvi& a_ta) { LI(i, 0, (int)ta.size()) { copy(a_ta[i].begin(), a_ta[i].end(), back_inserter(ta[i])); } } #endif ll find_maximum(int k, vvi x) { int n = x.size(), m = x[0].size(); vvi talloc; LI(i, 0, n) { vi tallocr(m, -1); talloc.pb(tallocr); } ll ans = 0ll; // Subtask 1 if(m == 1) { vi vals; LI(i, 0, n) { vals.pb(x[i][0]); } sort(vals.begin(), vals.end()); LI(i, 0, n >> 1) { ans -= (ll)vals[i]; } LI(i, n >> 1, n) { ans += (ll)vals[i]; } LI(i, 0, n) { talloc[i][0] = 0; } } allocate_tickets(talloc); return ans; } #ifdef DEBUG int main() { int n, m, k; cin >> n >> m >> k; vvi x; LI(i, 0, n) { vi xr(m, 0); vi tar; INPV(xr); x.pb(xr); ta.pb(tar); } cout << find_maximum(k, x) << "\n"; LI(i, 0, n) { LI(j, 0, m) cout << ta[i][j] << " "; cout << "\n"; } return 0; } #endif
#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...