Submission #1064438

#TimeUsernameProblemLanguageResultExecution timeMemory
1064438woodHoliday (IOI14_holiday)C++17
47 / 100
5067 ms2148 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; #define vi vector<int> #define ll long long #define pb push_back long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll result = 0; for (int i = 0; i <= start; ++i) { ll sum = 0; priority_queue<int,vi,greater<>> q; for(int j = i; j<start; j++){ q.push(attraction[j]); sum+=attraction[j];} for(int j = start; j<n; j++){ int dist = j-i+min(j-start,start-i); if(d<dist) continue; q.push(attraction[j]); sum+=attraction[j]; while(q.size()>d-dist){ sum-=q.top(); q.pop(); } result = max(result,sum); } } return result; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:19:18: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<void> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |    while(q.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...