이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
ll find_maximum(int k, vector<vector<int>> x) {
int n = sz(x);
int m = sz(x[0]);
vector<ll> dp(n/2+1), last(n/2+1);
vector<vector<int>> ans(n);
vector<vector<bool>> pai(n);
for(int i = 0; i < n; i++) {
ans[i].resize(m, -1);
pai[i].resize(n/2+1);
dp[0] -= x[i][0];
for(int j = 1; j <= n/2; j++) {
ll a = last[j] - (ll)x[i][0], b = last[j-1] + (ll)x[i].back();
if(a > b) pai[i][j] = 0, dp[j] = a;
else pai[i][j] = 1, dp[j] = b;
//cout << "[" << i << ", " << j << "] = " << dp[j] << "\n";
}
last = dp;
}
for(int i = n-1, j = n/2; i >= 0; i--) {
if(pai[i][j]) ans[i][m-1] = 0, j--;
else ans[i][0] = 0;
}
allocate_tickets(ans);
return dp[n/2];
}
# | 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... |