Submission #1064439

#TimeUsernameProblemLanguageResultExecution timeMemory
1064439YassirSalamaHoliday (IOI14_holiday)C++17
0 / 100
5047 ms1368 KiB
#include"holiday.h" #include<bits/stdc++.h> using namespace std; #define ll long long int arr[21]; bool visited[21]; int n,d; ll solve(int i,int d){ if(d<=0) return 0; ll ans=0; for(int j=0;j<n;j++){ if(i==j) continue; if(visited[j]) continue; visited[i]=1; ans=max(ans,arr[i]+solve(j,d-abs(i-j)-1)); ans=max(ans,solve(i,d-abs(i-j))); visited[i]=0; } return ans; } long long int findMaxAttraction(int _n, int start, int _d, int v[]) { ll ans = 0; n=_n; d=_d; for(int i=0;i<n;i++){ arr[i]=v[i]; } memset(visited,false,sizeof(visited)); return solve(start,d); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...