Submission #1321427

#TimeUsernameProblemLanguageResultExecution timeMemory
1321427thesentroFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h" #include <bits/stdc++.h> std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) { ll n = P.size(); ll c = A; vector<ll>v = P, h = T; vector<pair<ll,ll>>vp; for (int i=0 ; i<n ; i++) { vp.push_back({v[i], i}); } sort(vp.begin(), vp.end()); vector<ll>ans; for (auto i:vp) { if (c>=i.first) { c-=i.first; ans.push_back(i.second); } } return ans; }

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:4:7: error: 'll' was not declared in this scope
    4 |       ll n = P.size();
      |       ^~
festival.cpp:5:9: error: expected ';' before 'c'
    5 |       ll c = A;
      |         ^~
      |         ;
festival.cpp:7:7: error: 'vector' was not declared in this scope
    7 |       vector<ll>v = P, h = T;
      |       ^~~~~~
festival.cpp:7:7: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from festival.h:1,
                 from festival.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
festival.cpp:7:17: error: 'v' was not declared in this scope
    7 |       vector<ll>v = P, h = T;
      |                 ^
festival.cpp:7:24: error: 'h' was not declared in this scope
    7 |       vector<ll>v = P, h = T;
      |                        ^
festival.cpp:8:14: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    8 |       vector<pair<ll,ll>>vp;
      |              ^~~~
      |              std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/vector:62:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
festival.cpp:8:26: error: 'vp' was not declared in this scope
    8 |       vector<pair<ll,ll>>vp;
      |                          ^~
festival.cpp:9:24: error: 'n' was not declared in this scope
    9 |       for (int i=0 ; i<n ; i++)
      |                        ^
festival.cpp:13:7: error: 'sort' was not declared in this scope
   13 |       sort(vp.begin(), vp.end());
      |       ^~~~
festival.cpp:13:7: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:73,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from festival.cpp:2:
/usr/include/c++/13/pstl/glue_algorithm_defs.h:296:1: note:   'std::sort'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
In file included from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_algo.h:1801:30: note:   'std::ranges::sort'
 1801 |   inline constexpr __sort_fn sort{};
      |                              ^~~~
festival.cpp:14:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |       vector<ll>ans;
      |                 ^~~
      |                 abs
festival.cpp:17:15: error: 'c' was not declared in this scope
   17 |           if (c>=i.first)
      |               ^