Submission #619770

#TimeUsernameProblemLanguageResultExecution timeMemory
619770CoolRabbitXTFinancial Report (JOI21_financial)C++14
0 / 100
4059 ms1048576 KiB
#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)

Main.cpp: In function 'int solve(int, int)':
Main.cpp:10:7: warning: unused variable 'best_option' [-Wunused-variable]
   10 |   int best_option = 0;
      |       ^~~~~~~~~~~
Main.cpp:11:7: warning: unused variable 'best_indx' [-Wunused-variable]
   11 |   int best_indx;
      |       ^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...