이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long A[1005], B[1005];
pair<long long,long long> lst[1005];
long long find_maximum(int k, vector<vector<int>> x) {
long long N = x.size(), M = x[0].size();
memset(A,0,sizeof(A)); memset(B,0,sizeof(B));
for (long long i = 0; i < N; ++i) {
lst[i] = make_pair(0,i);
for (long long j = 0; j < M; ++j) lst[i].first += x[i][j];
while (B[i] < M && x[i][B[i]] == 0) B[i]++;
}
long long val = 0;
vector< vector<int> > ans (N, vector<int>(M,-1));
for (long long i = 0; i < k; ++i) {
sort(lst,lst+N);
for (long long j = 0; j < N/2; ++j) {
long long n = lst[j].second;
if ((A[n] < M && x[n][A[n]] == 0) || B[n] >= M) ans[n][A[n]] = i, A[n]++;
else ans[n][B[n]] = i, B[n]++, val--, lst[j].first--;
}
for (long long j = N/2; j < N; ++j) {
long long n = lst[j].second;
if (B[n] < M) ans[n][B[n]] = i, B[n]++, val++, lst[j].first--;
else ans[n][A[n]] = i, A[n]++;
}
}
allocate_tickets(ans);
return val;
}
# | 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... |