Submission #1032219

#TimeUsernameProblemLanguageResultExecution timeMemory
1032219tolbiHoliday (IOI14_holiday)C++17
0 / 100
5018 ms2436 KiB
#include"holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int l = 0; l < n; l++){ priority_queue<int,vector<int>,greater<int>> pq; ll somma = 0; for (int i = l; i < start; i++){ pq.push(attraction[i]); somma+=attraction[i]; } for (int r = l; r < n; r++){ pq.push(attraction[r]); somma+=attraction[r]; int mv; if (l<=start && r>=start){ mv = r-l+min(start-l,r-start); } else mv=max(abs(start-l),abs(start-r)); int kal = d-mv; while (pq.size()>kal){ somma-=pq.top(); pq.pop(); } ans=max(ans,somma); } } return ans; }

Compilation message (stderr)

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