Submission #722193

#TimeUsernameProblemLanguageResultExecution timeMemory
722193Ronin13Holiday (IOI14_holiday)C++14
23 / 100
38 ms5556 KiB
#include"holiday.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pb push_back
#define epb emplace_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;


long long int findMaxAttraction(int n, int start, int d, int a[]) {
    if(start == 0){
        multiset <ll> st;
        ll s = 0;
        ll mx = 0;
        for(int i = 0; i < n; i++){
            int x = d - i;
            st.insert(a[i]);
            s += a[i];
            while(st.size() > x)
                s -= *st.begin(), st.erase(st.begin());
            mx = max(mx, s);
        }
        return mx;
    }
    return 0;
}

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:23:29: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |             while(st.size() > x)
      |                   ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...