이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;
long long find_maximum(int k, vector<vector<int>> X) {
int n = X.size();
int m = X[0].size();
ll res1 = 0;
vector < int > ls( m , m - 1 ) , st( m , 0 );
vector < vector < int > > ans( n , vector < int > (m , -1) );
for( int it = 0; it < k; it++ ){
vector < pair < ll , int > > res;
ll cnt = 0;
for( int i = 0; i < n; i++ ){
res.push_back({ -X[i][st[i]] - X[i][ls[i]] , i });
cnt += X[i][ls[i]];
}
sort( res.rbegin() , res.rend() );
for( int i = 0; i < n / 2; i++ ){
ans[res[i].se][st[res[i].se]++] = it;
cnt += res[i].fi;
}
for( int i = n / 2; i < n; i++ ){
ans[res[i].se][ls[res[i].se]--] = it;
}
res1 += cnt;
}
allocate_tickets( ans );
return res1;
}
# | 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... |