Submission #587044

#TimeUsernameProblemLanguageResultExecution timeMemory
587044krit3379Holiday (IOI14_holiday)C++17
23 / 100
432 ms1960 KiB
#include<bits/stdc++.h> #include"holiday.h" using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 100005 long long sum,ans; priority_queue<long long,vector<long long>,greater<long long>> q; void add(long long x){ q.push(x); sum+=x; } void upd(int k){ while(!q.empty()&&q.size()>k){ sum-=q.top(); q.pop(); } } long long int findMaxAttraction(int n,int st,int d,int a[]){ int i,j; if(n<=3000){ for(i=0;i<=st;i++){ sum=0; for(j=i;j<st;j++)add(a[j]); for(j=st;j<n;j++){ add(a[j]); upd(d-j+i-min(st-i,j-st)); ans=max(ans,sum); } } } else if(st==0){ sum=0; for(i=0;i<n;i++){ add(a[i]); upd(d-i); ans=max(ans,sum); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'void upd(int)':
holiday.cpp:17:31: 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]
   17 |     while(!q.empty()&&q.size()>k){
      |                       ~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...