Submission #623621

#TimeUsernameProblemLanguageResultExecution timeMemory
623621John3_141592Carnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms688 KiB
#include "tickets.h" #include <bits/stdc++.h> #define ll long long #define par pair<int,int> #define f first #define s second #define ld long duble #define ull unsigned long long #define st short int using namespace std; ll find_maximum(int k,vector<vector<int>>x){ int n=x.size(),m=x[0].size(); vector <vector<int>> vec; priority_queue <pair<int,par>> cola; for(int i=0;i<n;i++) cola.push({x[i][m-1],{i,m-1}}); int asd[n][m],qwe[n][m],arr[n],brr[n]; memset(asd,-1,sizeof(asd)),memset(qwe,0,sizeof(qwe)),fill(arr,arr+n,k),fill(brr,brr+n,0); for(int i=0;i<n;i++){ for(int j=0;j<k;j++) qwe[i][j]=-1; arr[i]=k; } ll solve=0; for(int j=0;j<k;j++){ bool vis[n]; fill(vis,vis+n,false); for(int i=0;i<n/2;i++){ int a=cola.top().s.f,b=cola.top().s.s; qwe[a][b]=1,solve+=x[a][b],asd[a][b]=j,cola.pop(),vis[a]=true,arr[i]--,cola.push({x[a][b-1],{a,b-1}}),qwe[a][arr[i]]=0; } for(int i=0;i<n;i++){ if(vis[i]) continue; solve-=x[i][brr[i]],asd[i][brr[i]]=j,brr[i]++; } } vector <vector <int>> answer; for(int i=0;i<n;i++){ vector <int> aux; for(int j=0;j<m;j++) aux.push_back(asd[i][j]); answer.push_back(aux); } allocate_tickets(answer); return solve; }
#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...