# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
638892 | teesla | Financial Report (JOI21_financial) | C++14 | 4078 ms | 48536 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>
using namespace std;
int n,d;
vector<int> v;
int res=0;
void build(vector<int> a, int x){
if(x!=-1){
build(a,x-1);
a.push_back(x);
build(a,x-1);
}
else{
for(int i=1; i<a.size(); i++){
if(a[i-1]-a[i]> d){
return;
}
}
int aux=0, maior=-1;
for(int i=a.size()-1; i>=0; i--){
if(v[a[i]]>maior){
aux++;
maior=v[a[i]];
}
}
res=max(res,aux);
}
return;
}
int main(){
cin >> n >> d;
for(int i=0; i<n; i++){
int a;
cin >> a;
v.push_back(a);
}
vector<int> a;
a.push_back(n-1);
build(a,n-2);
cout << res<<endl;
}
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... |