이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define rmin(r, x) r = min(r, x)
#define rmax(r, x) r = max(r, x)
#define ends ' '
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxn = 1510;
const int maxm = 1510;
int n, m, l[maxn], r[maxn];
vector<vector<int>> ans;
long long find_maximum(int k, vector<vector<int>> x) {
n = x.size();
m = x[0].size();
ans.resize(n);
for(int i = 0; i < n; ++i) {
ans[i].resize(m, -1);
l[i] = 0, r[i] = m - 1;
}
ll ret = 0;
vector<int> v;
for(int i = 0; i < n; ++i) v.eb(i);
for(int T = 0; T < k; ++T) {
for(int i = 0; i < n; ++i) {
ret -= x[i][l[i]];
}
sort(all(v), [&](int i, int j) { return x[i][l[i]] + x[i][r[i]] > x[j][l[j]] + x[j][r[j]]; });
for(int i = 0; i < n; ++i) {
int j = v[i];
if(i < n / 2) {
ret += x[j][l[j]] + x[j][r[j]];
ans[j][r[j]--] = T;
}
else {
ans[j][l[j]++] = T;
}
}
}
allocate_tickets(ans);
return ret;
}
# | 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... |