Submission #915308

#TimeUsernameProblemLanguageResultExecution timeMemory
915308Trisanu_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 k, int a[]){ long long ans = 0; if(s == 0){ multiset<int> ss; long long curr; for(int j = 0; j < min(n, k - 1); j++){ ss.insert(a[i]); curr += a[i]; while(j + ss.size() > k){ curr -= *ss.begin(); s.erase(s.begin()); } ans = max(ans, curr); } return ans; } }

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:10:19: error: 'i' was not declared in this scope
   10 |       ss.insert(a[i]);
      |                   ^
holiday.cpp:12:27: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |       while(j + ss.size() > k){
      |             ~~~~~~~~~~~~~~^~~
holiday.cpp:14:11: error: request for member 'erase' in 's', which is of non-class type 'int'
   14 |         s.erase(s.begin());
      |           ^~~~~
holiday.cpp:14:19: error: request for member 'begin' in 's', which is of non-class type 'int'
   14 |         s.erase(s.begin());
      |                   ^~~~~
holiday.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^