Submission #638886

#TimeUsernameProblemLanguageResultExecution timeMemory
638886SofiatpcFinancial Report (JOI21_financial)C++14
14 / 100
2589 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 25; int N,D,a[MAXN],ans; bool marc[MAXN]; void bt(int i, int l) { if(i>N) { int cur=0; for(int j = 1; j <= N; j++) { if(!marc[j])continue; bool b = false; for(int k = 1; k < j; k++) if(marc[k] && a[k]>=a[j]){b=true; break;} if(!b)cur++; } ans=max(ans,cur); return; } if(i-l<D || l==0)bt(i+1,l); marc[i]=true; bt(i+1,i); marc[i]=false; return; } int main() { cin>>N>>D; for(int i = 1; i <= N; i++)cin>>a[i]; bt(1, 0); cout<<ans<<"\n"; }
#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...