Submission #992562

#TimeUsernameProblemLanguageResultExecution timeMemory
992562Khanhcsp2Holiday (IOI14_holiday)C++14
23 / 100
19 ms3104 KiB
#include<bits/stdc++.h> #define el '\n' #define fi first #define sc second //#define int ll #define pii pair<int, int> #define all(v) v.begin(), v.end() using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; const int mod=1e9+7; const int N=1e5+11; priority_queue<int, vector<int>, greater<int>> q; int a[N], b[N]; ll findMaxAttraction(int n, int start, int d, int att[]) { for(ll i=0;i<n;i++) a[i+1]=att[i]; ll sum=0, ans=a[1]; if(d==0) return 0ll; for(int i=1;i<d;i++) q.push(0); sum+=a[1]; q.push(a[1]); for(int i=2;i<=n;i++) { sum+=a[i]; q.push(a[i]); sum-=q.top(); q.pop(); sum-=q.top(); q.pop(); ans=max(ans, sum); if(q.empty()) break; } return ans; } //void sol() //{ // cin >> n >> s >> d; // for(int i=0;i<n;i++) cin >> b[i]; // cout << findMaxAttraction(n, s, d, b); //} //signed main() //{ //// freopen("divisor.INP", "r", stdin); //// freopen("divisor.OUT", "w", stdout); // ios_base::sync_with_stdio(0); // cin.tie(0); // int t=1; // //cin >> t; // while(t--) // { // sol(); // } //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...