Submission #915323

#TimeUsernameProblemLanguageResultExecution timeMemory
915323Trisanu_DasHoliday (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "holiday.h" using namespace std; long long findMaxAttraction(int n, int s, int d, int a[]) { long long ans = 0; for(int l = 0; l <= st; l++) { priority_queue<long long, vector<long long>, greater<long long> > pq; long long curr = 0; for (int r = l; r < n; r++) { curr += a[r]; pq.push(a[r]); int sm = min(abs(r - s), abs(l - s)) + r - l; sm = d - sm; if(sm < 0) continue; while(pq.size() > sm) curr -= pq.top(), pq.pop(); ans = max(ans, curr); } } return ans; }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:7:25: error: 'st' was not declared in this scope; did you mean 's'?
    7 |     for(int l = 0; l <= st; l++) {
      |                         ^~
      |                         s
holiday.cpp:16:29: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |             while(pq.size() > sm) curr -= pq.top(), pq.pop();
      |                   ~~~~~~~~~~^~~~