Submission #992562

# Submission time Handle Problem Language Result Execution time Memory
992562 2024-06-04T16:47:51 Z Khanhcsp2 Holiday (IOI14_holiday) C++14
23 / 100
19 ms 3104 KB
#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 time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 604 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 15 ms 2516 KB Output is correct
2 Correct 11 ms 2516 KB Output is correct
3 Correct 16 ms 2436 KB Output is correct
4 Correct 14 ms 2512 KB Output is correct
5 Correct 16 ms 2008 KB Output is correct
6 Correct 6 ms 2064 KB Output is correct
7 Correct 9 ms 1752 KB Output is correct
8 Correct 14 ms 1904 KB Output is correct
9 Correct 5 ms 1996 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 19 ms 3104 KB Output is correct
2 Correct 18 ms 3028 KB Output is correct
3 Incorrect 6 ms 1372 KB Output isn't correct
4 Halted 0 ms 0 KB -