Submission #804645

# Submission time Handle Problem Language Result Execution time Memory
804645 2023-08-03T10:40:27 Z oviyan_gandhi Best Place (NOI17_bestplace) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n; cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\n';
  return 0;
}

Compilation message

bestplace.cpp: In function 'int main()':
bestplace.cpp:8:28: error: no matching function for call to 'accumulate(int [n], int*)'
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\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 bestplace.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:
bestplace.cpp:8:28: note:   candidate expects 3 arguments, 2 provided
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\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 bestplace.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:
bestplace.cpp:8:28: note:   candidate expects 4 arguments, 2 provided
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\n';
      |                            ^
bestplace.cpp:8:59: error: no matching function for call to 'accumulate(int [n], int*)'
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\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 bestplace.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:
bestplace.cpp:8:59: note:   candidate expects 3 arguments, 2 provided
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\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 bestplace.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:
bestplace.cpp:8:59: note:   candidate expects 4 arguments, 2 provided
    8 |   cout << accumulate(x, x+n)/n << ' ' << accumulate(y, y+n)/n << '\n';
      |                                                           ^