Submission #424428

#TimeUsernameProblemLanguageResultExecution timeMemory
424428APROHACKHoliday (IOI14_holiday)C++14
0 / 100
5067 ms3028 KiB
#include"holiday.h" #include <bits/stdc++.h> #define PB push_back #define F first #define S second using namespace std; //int att[100000]; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ////for(int i = 0 ; i < n ; i++)att[i]=attraction[i]; long long rta = 0; for(int left = start ; left>= 0 ; left++){ long long cur = 0; priority_queue<long long>pq; for(int i = left ; i < start ; i++){ pq.push(-attraction[i]); cur+=attraction[i]; } for(int r = start ; r< n ; r++){ cur+=attraction[r]; pq.push(-attraction[r]); int dist = r - left + min(start - left, r - start); if(d - dist <= 0) break; while(pq.size() > d - dist){ cur -= pq.top(); pq.pop(); } rta = max(cur, rta); } } return rta; }

Compilation message (stderr)

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