This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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();
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);
vector <pair<int,par>> vec;
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]--,vec.push_back({x[a][b-1],{a,b-1}}),qwe[a][arr[i]]=0;
}
for(auto i:vec) cola.push(i);
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |