제출 #1240488

#제출 시각아이디문제언어결과실행 시간메모리
1240488MuhammadSaram비스킷 담기 (IOI20_biscuits)C++20
컴파일 에러
0 ms0 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define ll long long long long count_tastiness(long long x, vector<long long> a) { ll su=0; reverse(a.begin(),a.back()); while (a.size() && !a.back()) a.pop_back(); reverse(a.begin(),a.end()); while (a.size() && !a.back()) a.pop_back(); ll mul=1; for (int i=0;i<a.size();i++) { su+=a[i]*(1ll<<i); if (su<(1ll<<i)) mul*=2; } return (su+1)/mul; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:10:16: error: no matching function for call to 'reverse(std::vector<long long int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   10 |         reverse(a.begin(),a.back());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from biscuits.h:1,
                 from biscuits.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:1145:5: note: candidate: 'template<class _BIter> constexpr void std::reverse(_BIter, _BIter)'
 1145 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/11/bits/stl_algo.h:1145:5: note:   template argument deduction/substitution failed:
biscuits.cpp:10:16: note:   deduced conflicting types for parameter '_BIter' ('__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' and 'long long int')
   10 |         reverse(a.begin(),a.back());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from biscuits.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:249:1: note:   template argument deduction/substitution failed:
biscuits.cpp:10:16: note:   candidate expects 3 arguments, 2 provided
   10 |         reverse(a.begin(),a.back());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~