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 a = n+1, b = -1, cnt = 0;
ll val = 0;
// cerr << k << " ";
for(int i=0;i<n;i++){
cerr << ((1<<i)&k);
if(((1<<i)&k)>0){
a = min(i,a);
b = max(b,i);
cnt ++;
val += attraction[i];
}
}
// cerr << " | " << a << " " << b;
int len = b-a;
a = min(abs(start - a),abs(start - b));
// cerr << " | " << a << " " << len << " " << cnt << " " << val << endl;
if((a+len+cnt) > d)continue;
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... |