제출 #1321429

#제출 시각아이디문제언어결과실행 시간메모리
1321429thesentroFestival (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
#include "festival.h" #include <bits/stdc++.h> #define ll long long 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; }

컴파일 시 표준 에러 (stderr) 메시지

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:8:7: error: 'vector' was not declared in this scope
    8 |       vector<ll>v = P, h = T;
      |       ^~~~~~
festival.cpp:8: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:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
festival.cpp:8:14: note: in expansion of macro 'll'
    8 |       vector<ll>v = P, h = T;
      |              ^~
festival.cpp:9:14: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    9 |       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:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
festival.cpp:9:19: note: in expansion of macro 'll'
    9 |       vector<pair<ll,ll>>vp;
      |                   ^~
festival.cpp:12:11: error: 'vp' was not declared in this scope
   12 |           vp.push_back({v[i], i});
      |           ^~
festival.cpp:12:25: error: 'v' was not declared in this scope
   12 |           vp.push_back({v[i], i});
      |                         ^
festival.cpp:14:12: error: 'vp' was not declared in this scope
   14 |       sort(vp.begin(), vp.end());
      |            ^~
festival.cpp:14:7: error: 'sort' was not declared in this scope
   14 |       sort(vp.begin(), vp.end());
      |       ^~~~
festival.cpp:14: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:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
festival.cpp:15:14: note: in expansion of macro 'll'
   15 |       vector<ll>ans;
      |              ^~
festival.cpp:21:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |               ans.push_back(i.second);
      |               ^~~
      |               abs
festival.cpp:24:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |       return ans;
      |              ^~~
      |              abs