Submission #1064219

#TimeUsernameProblemLanguageResultExecution timeMemory
1064219damjandavkovHoliday (IOI14_holiday)C++17
23 / 100
5053 ms2772 KiB
#include "holiday.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll findMaxAttraction(int n, int a, int d, int v[]) { ll s = 0, ms = 0, i, j; priority_queue<ll> q; if (!a) { for (i = 0; i < min(n, d); i++) { q.push(-v[i]); s += v[i]; while (q.size() > d - i) { s += q.top(); q.pop(); } ms = max(ms, s); } return ms; } for (i = 0; i <= a; i++) { s = 0; for (j = i; j < n; j++) { q.push(-v[j]); s += v[j]; while (q.size() > d - j + i - min(a - i, j - a)) { s += q.top(); q.pop(); } if (j >= a) ms = max(ms, s); } while (!q.empty()) q.pop(); } return ms; }

Compilation message (stderr)

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