# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432067 | peuch | Carnival Tickets (IOI20_tickets) | C++17 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long find_maximum(int k, vector<vector<int> > x) {
int n = x.size();
int m = x[0].size();
vector<int> dp (n);
vector<vector<bool> > bt (n, vector<bool> (n, 0));
vector<vector<pair<int, int> > > ord (n, vector<pair<int, int> > (m));
vector<vector<int> > ans (n, vector<int> (m, -1));
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++)
ord[i][j] = make_pair(x[i][j], j);
sort(ord[i].begin(), ord[i].end());
// printf("Para pilha %d, fundo = %d, topo = %d\n", i, ord[i][0].first, ord[i][m - 1].first);
}
for(int i = 0; i < n; i++){
for(int j = n / 2; j >= 0; j--){
dp[j] = dp[j] - ord[i][0].first;
if(j != 0 && dp[j - 1] + ord[i][m - 1].first > dp[j]) dp[j] = dp[j - 1] + ord[i][m - 1].first, bt[i][j] = 1;
// printf("dp[%d][%d] = %d\n", i, j, dp[j]);
}
}
int curI = n - 1, curJ = 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... |