제출 #549658

#제출 시각아이디문제언어결과실행 시간메모리
549658tabr친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif int findSample(int n, int c[], int h[], int p[]) { return accumulate(c + 1, c + n); } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); return 0; } #endif

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:10:35: error: no matching function for call to 'accumulate(int*, int*)'
   10 |     return accumulate(c + 1, c + n);
      |                                   ^
In file included from /usr/include/c++/10/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
                 from friend.cpp:1:
/usr/include/c++/10/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
  134 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
      |     ^~~~~~~~~~
/usr/include/c++/10/bits/stl_numeric.h:134:5: note:   template argument deduction/substitution failed:
friend.cpp:10:35: note:   candidate expects 3 arguments, 2 provided
   10 |     return accumulate(c + 1, c + n);
      |                                   ^
In file included from /usr/include/c++/10/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
                 from friend.cpp:1:
/usr/include/c++/10/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
  161 |     accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
      |     ^~~~~~~~~~
/usr/include/c++/10/bits/stl_numeric.h:161:5: note:   template argument deduction/substitution failed:
friend.cpp:10:35: note:   candidate expects 4 arguments, 2 provided
   10 |     return accumulate(c + 1, c + n);
      |                                   ^