# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379305 | eulerdesoja | Building 4 (JOI20_building4) | C++14 | 362 ms | 103788 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<bits/stdc++.h>
#include<fstream>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) int(x.size())
typedef pair<int,int>ii;
typedef vector<int> vi;
//we try to guess how many A's we will use on the building
//aparently (need to prove) the possibilities are contiguous
//i just need to find the minimum and maximum possible and check if n it is in it
const int mxn=1e6+5;
int n,a[2][mxn];
int dpmin[mxn][2],dpmax[mxn][2];
int smin(int i,int last){
if(i==0)return 0;
if(dpmin[i][last]!=-1)return dpmin[i][last];
int ans=1e9+5;
for(int j=0;j<2;j++){
if(a[j][i]<=a[last][i+1])ans=min(ans,smin(i-1,j)+j);
}
return dpmin[i][last]=ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |