# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385947 | alireza_kaviani | Holiday (IOI14_holiday) | C++11 | 18 ms | 2284 KiB |
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 <bits/stdc++.h>
#include"holiday.h"
using namespace std;
typedef long long ll;
const int MAXN = 8000;
int dp[MAXN] , ans[MAXN][2][2];
priority_queue<int , vector<int> , greater<int>> pq;
long long int findMaxAttraction(int n, int start, int d, int A[]) {
if(start == 0){
ll ans = 0 , sum = 0;
for(int i = 0 ; i < n ; i++){
sum += A[i];
pq.push(A[i]);
while(pq.size() > d - i){
sum -= pq.top(); pq.pop();
}
ans = max(ans , sum);
}
return ans;
}
for(int i = start ; i < n ; i++){
for(int j = n ; j >= 1 ; j--){
dp[j] = max(dp[j] , dp[j - 1] + A[i]);
}
for(int j = 0 ; j <= n ; j++){
ans[j + (i - start)][0][0] = max(ans[j + (i - start)][0][0] , dp[j]);
ans[j + (i - start) * 2][0][1] = max(ans[j + (i - start) * 2][0][1] , dp[j]);
}
}
return 0;
}
Compilation message (stderr)
# | 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... |