Submission #804645

#TimeUsernameProblemLanguageResultExecution timeMemory
804645oviyan_gandhiBest Place (NOI17_bestplace)C++14
Compilation error
0 ms0 KiB
#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 (stderr)

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';
      |                                                           ^