이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<vector<int>> answer(n, vector<int>(m,-1));
vector<int>cur(n,0);
ll res = 0;
set<pair<int,int>>s;
for(int i = 0; i < n; i++){
for(int j = m-k; j < m; j++){
res += x[i][j];
}
s.insert({x[i][0]+x[i][m-k],i});
}
for(int c = 0; c < k*n/2; c++){
auto p = *s.begin();
int val = p.ff;
int i = p.ss;
res -= val;
//cout << val << " " << i << endl;
s.erase(*s.begin());
cur[i]++;
int a = cur[i];
if(a < k)s.insert(make_pair(x[i][a]+x[i][m-k+a],i));
//a = 1
//x[i][1] + x[i][2-1+1]
}
for(int i = 0; i < n; i++){
int cnt = 0;
for(int j = 0; j < cur[i]; j++){
answer[i][j] = cnt;
cnt++;
}
for(int j = m - (k - cur[i]); j < m; j++){
answer[i][j] = cnt;
cnt++;
}
}
allocate_tickets(answer);
return res;
}
# | 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... |