이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
int i, j;
vector<vector<int>>answer = x;
for(i=0;i<n;i++)
for(j=0;j<m;j++)
answer[i][j] = -1;
long long wynik = 0;
priority_queue<pair<long long, pair<int, int>>>kolejka;
vector<set<int>>dodatnie(n), ujemne(n);
for(i=0;i<n;i++){
for(j=m-k;j<m;j++){
wynik+=x[i][j];
dodatnie[i].insert(j);
}
if(k<m){
kolejka.push({-(long long)x[i][m-k]-x[i][0], {i, 0}});
}
}
exit(0);
for(int minus=0;minus<k*n/2;minus++){
i = kolejka.top().second.first;
j = kolejka.top().second.second;
wynik+=kolejka.top().first;
kolejka.pop();
ujemne[i].insert(j);
j++;
dodatnie[i].erase(j+m-k);
if(j<k)
kolejka.push({-(long long)x[i][m-k+j]-x[i][j], {i,j}});
}
//0011111
//1111100
int bilans = 0;
for(i=0;i<k;i++){
for(j=0;j<n;j++){
if(dodatnie[j].size()>ujemne[j].size() || (dodatnie[j].size()==ujemne[j].size() && bilans>=0)){
auto it = *dodatnie[j].begin();
answer[j][it] = i;
bilans++;
dodatnie[j].erase(it);
}
else{
auto it = *ujemne[j].begin();
answer[j][it] = i;
bilans--;
ujemne[j].erase(it);
}
}
}
allocate_tickets(answer);
return wynik;
}
# | 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... |