Submission #441114

#TimeUsernameProblemLanguageResultExecution timeMemory
441114roseanne_pcyCarnival Tickets (IOI20_tickets)C++14
27 / 100
625 ms73180 KiB
#include "tickets.h" #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef vector<int> vi; typedef long long ll; #define f first #define s second #define pb push_back #define lb lower_bound #define ub upper_bound #define sz(x) (int)x.size() #define all(x) begin(x), end(x) #define rsz resize const int md = 1e9+7; const ll inf = 1e18; const int maxn = 2e3+5; template<class T> void ckmin(T &a, T b) { a = min(a, b); } template<class T> void ckmax(T &a, T b) { a = max(a, b); } int lst[maxn], mst[maxn]; int n, m; bool cmp(int x, int y) { return lst[x]+mst[x] > lst[y]+mst[y]; } long long find_maximum(int k, vector< vector<int> > b) { n = b.size(); m = b[0].size(); vector< vi > res(n, vector<int>(m, -1)); ll tot = 0; for(int i = 0; i< n; i++) { res[i][0] = 0; tot -= b[i][0]; lst[i] = b[i][0]; mst[i] = b[i][m-1]; } vector<int> allnums; for(int i = 0; i< n; i++) allnums.pb(i); sort(all(allnums), cmp); for(int i = 0; i< n/2; i++) { int x = allnums[i]; res[x][0] = -1; res[x][m-1] = 0; tot += b[x][0] + b[x].back(); } allocate_tickets(res); return tot; }
#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...