이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using ll = long long int;
#define pb push_back
#define F first
#define S second
ll find_maximum(int k, vector<vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<int> l(n,k-1),r(n,m),vec;
priority_queue<pii> pq;
vector<vector<int>> an(n,vector<int>(m,-1));
ll ans=0;
int rem=n*k/2;
for(int i=0; i<n; i++){
vec.pb(i);
for(int j=0; j<k; j++){
ans-=x[i][j];
}
pq.push({x[i][m-1]+x[i][k-1],i});
}
while(rem--){
auto [t,i]=pq.top();
pq.pop();
ans+=t;
l[i]--;
r[i]--;
if(l[i]>=0) pq.push({x[i][r[i]-1]+x[i][l[i]],i});
}
for(int i=0; i<k; i++){
sort(vec.begin(),vec.end(),[&](int &a, int &b){return l[a]>l[b];});
for(int j=0; j<n/2; j++){
an[vec[j]][l[vec[j]]]=i;
l[vec[j]]--;
}
for(int j=n/2; j<n; j++){
an[vec[j]][r[vec[j]]]=i;
r[vec[j]]++;
}
}
allocate_tickets(an);
return ans;
}
# | 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... |