Submission #787931

#TimeUsernameProblemLanguageResultExecution timeMemory
787931tolbiHoliday (IOI14_holiday)C++17
47 / 100
5058 ms1996 KiB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> ostream& operator<<(ostream& os, vector<X> v){for (auto &it : v) os<<it<<" ";return os;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> v){for (auto &it : v) os<<it<<" ";return os;}
ostream& operator<<(ostream& os, bool bl){return os<<(int32_t)bl;}
#define endl '\n'
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for(auto &it : x) cin>>it;
#define coutarr(x) for(auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define tol(bi) (1ll<<((int)(bi)))
typedef long long ll;
const ll INF = LONG_LONG_MAX;
const ll MOD = 1e9+9;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include"holiday.h"

long long int findMaxAttraction(int n, int start, int d, int arr[]) {
    ll ans = 0;
    for (int l = start; l >= 0; l--){
        ll crr = 0;
        priority_queue<ll,vector<ll>,greater<ll>> pq;
        for (int i = start-1; i >= l; i--){
            pq.push(arr[i]);
            crr+=arr[i];
        }
        for (int r = start; r < n; r++){
            int harc = (start-l)+(r-start)+min((start-l),(r-start));
            if (harc>=d) continue;
            harc=d-harc;
            pq.push(arr[r]);
            crr+=arr[r];
            while (pq.size()>harc){
                crr-=pq.top();
                pq.pop();
            }
            ans=max(ans,crr);
        }
    }
    return ans;
}

Compilation message (stderr)

holiday.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:48:29: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |             while (pq.size()>harc){
      |                    ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...