이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
#define V vector
#define S second
#define F first
#define pb push_back
#define P pair
#define all(v) v.begin(),v.end()
typedef long long ll;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int N=x.size();
int M=x[0].size();
V<P<int,P<int,int>>>vp;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
vp.pb({x[i][j],{i,j}});
}
}
sort(all(vp));
int size=vp.size();
ll ans=0;
for(int i=0;i<(N*M)/2;i++){
ans-=vp[i].F;
}
V<V<int>>D(N,V<int>(M,-1));
for(int i=(N*M)/2;i<N*M;i++)
ans+=vp[i].F;
for(int i=1;i<=M;i++){
for(int j=1;j<=N/2;j++){
int id1=(i-1)*(N/2)+j-1;
int id2=size-id1-1;
D[vp[id1].S.F][vp[id1].S.S]=i-1;
D[vp[id2].S.F][vp[id2].S.S]=i-1;
}
}
allocate_tickets(D);
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... |