# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68000 | KLPP | Ancient Books (IOI17_books) | C++14 | 634 ms | 42840 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 "books.h"
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef long long lld;
int arr[1000000];
int n;
int maxa,maxb;
lld DP[1000][1000];
lld computevalue(int i, int j){
//cout<<i<<" "<<j<<endl;
if(i<=maxa && maxb<=j)return 0;
if(DP[i][j]!=-1)return DP[i][j];
int start=i;
int end=j;
int newstart=start;
int newend=end;
do{
//cout<<start<<" "<<end<<endl;
start=newstart;
end=newend;
for(int x=start;x<=end;x++){
newstart=min(newstart,arr[x]);
newend=max(newend,arr[x]);
}
}while(!(newstart==start && newend==end));
DP[i][j]=1000000000000000000;
if(start>maxa){
DP[i][j]=min(DP[i][j],computevalue(start-1,end)+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... |