Submission #1282713

#TimeUsernameProblemLanguageResultExecution timeMemory
1282713gabrielz축제 (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h"

std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) {
  std::vector<int> R;
  
  std::sort(P.begin(), P.end());
  for (auto price : P) {
    if (A >= price) {
      A -= price;
      R.push_back(price);
    } else {
      break;
    }
  }

  return R;
}

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:6:8: error: 'sort' is not a member of 'std'
    6 |   std::sort(P.begin(), P.end());
      |        ^~~~