Submission #1015423

#TimeUsernameProblemLanguageResultExecution timeMemory
1015423AmirAli_H1Holiday (IOI14_holiday)C++17
47 / 100
5085 ms2000 KiB
// In the name of Allah #include <bits/stdc++.h> #include "holiday.h" using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<ld> cld; #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) #define F first #define S second #define pb push_back #define sep ' ' #define endl '\n' #define Mp make_pair #define kill(x) cout << x << '\n', exit(0) #define set_dec(x) cout << fixed << setprecision(x); #define file_io(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 2e5 + 7; int n, v, d; priority_queue<ll> qu; int num = 0; ll sm = 0; ll findMaxAttraction(int Nx, int Sx, int Dx, int A[]) { n = Nx; v = Sx; d = Dx; ll res = 0; for (int i = v; i >= 0; i--) { num = 0; sm = 0; while (!qu.empty()) qu.pop(); for (int j = i; j < v; j++) { qu.push(-A[j]); num++; sm += A[j]; } for (int j = v; j < n; j++) { qu.push(-A[j]); num++; sm += A[j]; ll R = d - ((j - i) + min(j - v, v - i)); if (R <= 0) break; while (num > R) { ll x = -qu.top(); qu.pop(); num--; sm -= x; } res = max(res, sm); } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...