#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define F first
#define S second
#define ll long long
// #define int ll
#define pb push_back
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define mem(a,i) memset(a,i,sizeof(a))
#define in insert
#define lb lower_bound
#define ub upper_bound
#define y1 yy
#define ppb pop_back
#define ull unsigned ll
const int MAX=1e5+55;
const int inf=1e9;
const int N=2e5;
const int C=331;
const int C1=431;
const int mod=1e9+9;
const int mod1=1e9+9;
#include "holiday.h"
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
multiset<int> st;
int ans=0;
int cur=0;
for(int i=0;i<n;i++){
st.in(attraction[i]);
cur+=attraction[i];
while(!st.empty()&&sz(st)>d-i){
cur-=*st.begin();
st.erase(st.begin());
}
ans=max(ans,cur);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
5460 KB |
Output is correct |
2 |
Correct |
20 ms |
5564 KB |
Output is correct |
3 |
Correct |
20 ms |
5496 KB |
Output is correct |
4 |
Correct |
20 ms |
5468 KB |
Output is correct |
5 |
Correct |
23 ms |
3924 KB |
Output is correct |
6 |
Correct |
7 ms |
2140 KB |
Output is correct |
7 |
Correct |
13 ms |
2900 KB |
Output is correct |
8 |
Correct |
15 ms |
2908 KB |
Output is correct |
9 |
Correct |
5 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
6228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |