Submission #1075361

#TimeUsernameProblemLanguageResultExecution timeMemory
1075361mindiyakHoliday (IOI14_holiday)C++14
7 / 100
5063 ms1628 KiB
#include"holiday.h" #include <vector> #include <set> #include <iostream> using namespace std; #define ll long long ll ans = 0; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { for(int k=1;k<(1<<n);k++){ int len = 32 - (__builtin_clz(k) + __builtin_ctz(k)) - 1; int a = __builtin_ctz(k); int b = 31 - __builtin_clz(k); int cost = __builtin_popcount(k) + len + min(abs(a - start), abs(b - start)); if(cost > d)continue; ll val = 0; for(int i=0;i<n;i++){ if(((1<<i)&k)>0){ val += attraction[i]; } } ans = max(ans,val); } 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...