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"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 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... |