Submission #432067

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4320672021-06-17 20:14:57peuchCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms204 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...