Submission #804651

#TimeUsernameProblemLanguageResultExecution timeMemory
804651oviyan_gandhiBest Place (NOI17_bestplace)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> x(n), y(n); for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/n << '\n'; return 0; }

Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:8:40: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/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:40: note:   candidate expects 3 arguments, 2 provided
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/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:40: note:   candidate expects 4 arguments, 2 provided
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/n << '\n';
      |                                        ^
bestplace.cpp:8:83: error: no matching function for call to 'accumulate(std::vector<int>::iterator, std::vector<int>::iterator)'
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/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:83: note:   candidate expects 3 arguments, 2 provided
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/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:83: note:   candidate expects 4 arguments, 2 provided
    8 |   cout << accumulate(x.begin(), x.end())/n << ' ' << accumulate(y.begin(), y.end())/n << '\n';
      |                                                                                   ^