이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "tickets.h"
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vec> vvec;
const int N=1505;
int n,m,d[N],s[N];
ll sum;
vector<pair<int,int> > v,l;
ll find_maximum(int k,vvec x){
n=x.size();m=x[0].size();
vvec ans(n,vec(m,-1));
for(int i=0;i<n;i++)
for(int j=0;j<k;j++) {sum+=x[i][m-1-j];v.push_back(make_pair(x[i][j]+x[i][m-k+j],i));}
sort(v.begin(),v.end());
for(int i=0;i<n*k/2;i++) {sum-=v[i].fi;d[v[i].se]++;}
for(int i=0;i<n;i++){
l.clear();
for(int j=0;j<k;j++) l.push_back(make_pair(s[j],j));
sort(l.begin(),l.end());
for(int j=0;j<k;j++)
if(j<d[i]) {ans[i][j]=l[j].se;s[l[j].se]++;}
else ans[i][m-k+j]=l[j].se;
}
allocate_tickets(ans);return sum;
}
# | 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... |