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