Submission #1075358

#TimeUsernameProblemLanguageResultExecution timeMemory
1075358mindiyakHoliday (IOI14_holiday)C++14
0 / 100
5049 ms10472 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 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...