Submission #430038

#TimeUsernameProblemLanguageResultExecution timeMemory
430038Rouge_HugoHoliday (IOI14_holiday)C++14
24 / 100
5082 ms5248 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; if(d>=1) mx=a[start]; for(int i=start; i<n; i++) { int r=d; ll ans=0; s.clear();s.insert(a[start]);ans=a[start]; for(int j=start+1;j<=i;j++) { r-=2; if(r<=0)break; ans+=a[j]; s.insert(a[j]); while(s.size()>r) { ans-=*s.begin(); s.erase(s.begin()); } mx=max(mx,ans); } for(int j=start-1; j>-1; j--) { r--; if(r<=0) break; s.insert(a[j]); ans+=a[j]; if(r<=0) break; while(s.size()>r) { ans-=*s.begin(); s.erase(s.begin()); } mx=max(mx,ans); } } for(int i=start; i<n; i++) { int r=d; ll ans=0; s.clear();s.insert(a[start]);ans=a[start]; for(int j=start+1;j<=i;j++) { r--; if(r<=0)break; ans+=a[j]; s.insert(a[j]); while(s.size()>r) { ans-=*s.begin(); s.erase(s.begin()); } mx=max(mx,ans); } for(int j=start-1; j>-1; j--) { r-=2; if(r<=0) break; s.insert(a[j]); ans+=a[j]; 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:27: 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)
      |                   ~~~~~~~~^~
holiday.cpp:42:27: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |             while(s.size()>r)
      |                   ~~~~~~~~^~
holiday.cpp:61:27: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   61 |             while(s.size()>r)
      |                   ~~~~~~~~^~
holiday.cpp:78:27: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   78 |             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...