# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619770 | CoolRabbitXT | Financial Report (JOI21_financial) | C++14 | 4059 ms | 1048576 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> arr;
int current_max;
int solve(int indx, int maxi){
vector <int> options;
options.resize(d);
int condition;
int best_option = 0;
int best_indx;
int the_max = 0;
//Esta DP va a recorrer el arreglo para atrás, utilizando los minimos.
//Caso base:
if(indx == n-1) {
if(arr[indx] > maxi) return 1;
else return 0;
}
//!importante! recuerda mirar que indx + i < n
//Caso recursivo:
if(arr[indx+1] > maxi){
condition = 1;
the_max = arr[indx+1];
}
else {
the_max = maxi;
condition = 0;
}
return solve(indx + 1, the_max) + condition;
}
int main(){
cin >> n >> d;
arr.resize(n);
for(int i = 0; i<n; i++){
cin >> arr[i];
}
for(int i = 0; i<n; i++){
//cout << "for indx: " << i << ": " << solve(i, arr[i]) << endl;
if(solve(i, arr[i]) > current_max) {
current_max = solve(i, arr[i]);
}
}
cout << current_max + 1;
}
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... |