# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
903191 | Sir_Ahmed_Imran | Holiday (IOI14_holiday) | C++17 | 5024 ms | 6236 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.
///~~~LOTA~~~///
#include "holiday.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define MAXN 100001
ll findMaxAttraction(int n,int s,int d,int a[]){
ll m,o,p,q;
multiset<ll> S;
for(int i=m=0;i<n;i++){
o=0;
for(int j=i;j<n;j++){
if(j<=s)
p=q=s-i;
else if(i>=s)
p=q=j-s;
else{
p=s-2*i+j;
q=2*j-s-i;
}
p=min(p,q);
p=d-p;
if(p<=0) break;
while(S.size()>p){
o-=*S.begin();
S.erase(S.begin());
}
if(S.size()<p){
o+=a[j];
S.insert(a[j]);
}
else if(*S.begin()<a[j]){
o+=a[j]-*S.begin();
S.insert(a[j]);
S.erase(S.begin());
}
m=max(o,m);
}
S.clear();
if(!s) break;
}
return m;
}
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... |