# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078078 | anango | Carnival Tickets (IOI20_tickets) | C++17 | 1067 ms | 190424 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 <vector>
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<signed>> intify(vector<vector<int>> res) {
vector<vector<signed>> ans(res.size(),vector<signed>(res[0].size()));
for (int i=0; i<res.size(); i++) {
for (int j=0; j<res[0].size(); j++) {
ans[i][j] = res[i][j];
}
}
return ans;
}
long long find_maximum(signed k, std::vector<std::vector<signed>> x) {
//need to fill the grid with + and -
//exactly k of these in each row
//such that the total sum of + minus total sum of - is maximised
//so if we let the possible moves for each row be a set S, each element is {a,b}
//a is the increase in total sum of + minus total sum of -
//and b is the total change to the balance (number of + minus number of -)
//then effectively in each row we need to process these moves in a dp
//like if we let dp[i][balance] be the maximum answer after doing the first i rows with balance + minus - count
//the balance can be upto nk/2 = O(n^2), so O(n^3) states and thusforely O(n^4) time complexity
//passes for 63
//try optimise to O(n^3)
//randomise order of rows processed and hope the balance value doesn't become large in the optimal sol?
//actually quite reasonable
Compilation message (stderr)
# | 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... |