제출 #221371

#제출 시각아이디문제언어결과실행 시간메모리
221371FieryPhoenix휴가 (IOI14_holiday)C++11
23 / 100
48 ms6368 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; typedef long double ld; #define INF 2001001001 #define MOD 1000000007 ll ans; ll findMaxAttraction(int N, int S, int D, int arr[]){ { multiset<ll>mst; ll sum=0; for (int i=S;i<N;i++){ mst.insert(arr[i]); sum+=arr[i]; while ((int)mst.size()>D-(i-S)){ sum-=*mst.begin(); mst.erase(mst.find(*mst.begin())); } ans=max(ans,sum); } } { multiset<ll>mst; ll sum=0; for (int i=S;i>=0;i--){ mst.insert(arr[i]); sum+=arr[i]; while ((int)mst.size()>D-(S-i)){ sum-=*mst.begin(); mst.erase(mst.find(*mst.begin())); } ans=max(ans,sum); } } if (S==0){ return ans; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...