# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1043042 | 2024-08-03T19:00:56 Z | ALeonidou | Holiday (IOI14_holiday) | C++17 | 10 ms | 3792 KB |
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define pb push_back #define endl "\n" #define sz(x) (ll)x.size() typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } vi val; ll n; long long int findMaxAttraction(int N, int start, int D, int attraction[]) { ll s = start; n = N; ll d = D; for (ll i= 0; i<n; i++){ val.pb(attraction[i]); } if (d == 0) return 0; //subtask 2: priority_queue <ll, vi, greater<ll> > pq; ll ans = val[0]; pq.push(val[0]); ll cur = val[0]; for (ll i=1; i<min(n, d-1); i++){ ll e = d - i; cur += val[i]; pq.push(val[i]); while (e < sz(pq)){ cur -= pq.top(); pq.pop(); } ans = max(ans, cur); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 0 ms | 604 KB | Output is correct |
5 | Incorrect | 0 ms | 604 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3280 KB | Output is correct |
2 | Correct | 5 ms | 3280 KB | Output is correct |
3 | Correct | 6 ms | 3280 KB | Output is correct |
4 | Correct | 5 ms | 3180 KB | Output is correct |
5 | Correct | 10 ms | 2840 KB | Output is correct |
6 | Correct | 3 ms | 1496 KB | Output is correct |
7 | Correct | 5 ms | 2004 KB | Output is correct |
8 | Correct | 7 ms | 2080 KB | Output is correct |
9 | Correct | 2 ms | 1496 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 860 KB | Output is correct |
2 | Correct | 1 ms | 860 KB | Output is correct |
3 | Correct | 1 ms | 860 KB | Output is correct |
4 | Incorrect | 1 ms | 860 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 3788 KB | Output is correct |
2 | Correct | 9 ms | 3792 KB | Output is correct |
3 | Incorrect | 4 ms | 1752 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |