Submission #589405

#TimeUsernameProblemLanguageResultExecution timeMemory
589405yutabiHoliday (IOI14_holiday)C++14
23 / 100
31 ms5552 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll subtask(int n, int start, int d, int attraction[]) { ll ans=attraction[0]; multiset <int> st; st.insert(attraction[0]); ll sum=attraction[0]; for(int i=1;i<n;i++) { sum+=attraction[i]; st.insert(attraction[i]); while(st.size()>d-i) { sum-=*(st.begin()); st.erase(st.begin()); } //printf("%lld\n",sum); ans=max(ans,sum); } return ans; } long long int findMaxAttraction(int n, int start, int d, int attraction[]) { if(d==0) { return 0; } if(start==0) { return subtask(n,start,d,attraction); } assert(0); return 0; }

Compilation message (stderr)

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