Submission #430051

#TimeUsernameProblemLanguageResultExecution timeMemory
430051Rouge_HugoHoliday (IOI14_holiday)C++14
23 / 100
37 ms5556 KiB
#include<bits/stdc++.h> #include"holiday.h" #define ll long long #define fi first #define se second #define pb push_back using namespace std; multiset<ll>s; long long int findMaxAttraction(int n, int start, int d, int a[]) { ll mx=0;ll ans=0; if(d>=1) mx=a[start]; s.insert(a[0]); ans+=a[0];int r=d; for(int i=1;i<n;i++) { r--; if(r<=0) break; s.insert(a[i]); ans+=a[i]; if(r<=0) break; while(s.size()>r) { ans-=*s.begin(); s.erase(s.begin()); } mx=max(mx,ans); } return mx; }

Compilation message (stderr)

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