| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 300355 | daniel920712 | 카니발 티켓 (IOI20_tickets) | C++14 | 30 ms | 15616 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 <algorithm>
using namespace std;
struct A
{
int where;
int con;
}tt[1505];
vector < vector < int > > answer;
vector < int > row;
vector< vector<int> > all;
bool have[1505][1505];
long long DP[1505][1505];
int N,M;
long long F(long long here,long long con)
{
if(con>N/2) return -1e18;
if(here==N&&con!=N/2) return -1e18;
if(here==N) return 0;
if(have[here][con]) return DP[here][con];
have[here][con]=1;
DP[here][con]=max(F(here+1,con+1)+all[here][M-1],F(here+1,con)-all[here][0]);
return DP[here][con];
}
void F2(long long here,long long con)
{
if(here==N) return;
if(F(here+1,con+1)+all[here][M-1]>F(here+1,con)-all[here][0])
{
F2(here+1,con+1);
answer[here][M-1]=0;
}
else
{
F2(here+1,con);
answer[here][0]=0;
}
}
long long find_maximum(int k,vector< vector<int> > x)
{
all=x;
N=x.size();
M=x[0].size();
int i,j,t,ok,now;
long long ans=0;
for(i=0;i<M;i++) row.push_back(-1);
for(i=0;i<N;i++) answer.push_back(row);
if(k==1)
{
for(int i=0;i<N;i++) answer[i][0]=0;
ans=F(0,0);
}
allocate_tickets(answer);
return ans;
}
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... | ||||
