Submission #804660

#TimeUsernameProblemLanguageResultExecution timeMemory
804660oviyan_gandhiBest Place (NOI17_bestplace)C++14
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; int accumulate(vector<int> v){ int ret = 0; for (int i : v) ret += i; return ret; } 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)/n << ' ' << accumulate(y)/n << '\n'; return 0; }

Compilation message (stderr)

bestplace.cpp:4:16: error: 'vector' was not declared in this scope
    4 | int accumulate(vector<int> v){
      |                ^~~~~~
bestplace.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
bestplace.cpp:4:23: error: expected primary-expression before 'int'
    4 | int accumulate(vector<int> v){
      |                       ^~~
bestplace.cpp: In function 'int main()':
bestplace.cpp:12:3: error: 'vector' was not declared in this scope
   12 |   vector<int> x(n), y(n);
      |   ^~~~~~
bestplace.cpp:12:3: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
bestplace.cpp:12:10: error: expected primary-expression before 'int'
   12 |   vector<int> x(n), y(n);
      |          ^~~
bestplace.cpp:13:38: error: 'x' was not declared in this scope
   13 |   for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
      |                                      ^
bestplace.cpp:13:46: error: 'y' was not declared in this scope
   13 |   for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
      |                                              ^
bestplace.cpp:14:22: error: 'x' was not declared in this scope
   14 |   cout << accumulate(x)/n << ' ' << accumulate(y)/n << '\n';
      |                      ^
bestplace.cpp:14:23: error: 'accumulate' cannot be used as a function
   14 |   cout << accumulate(x)/n << ' ' << accumulate(y)/n << '\n';
      |                       ^
bestplace.cpp:14:48: error: 'y' was not declared in this scope
   14 |   cout << accumulate(x)/n << ' ' << accumulate(y)/n << '\n';
      |                                                ^
bestplace.cpp:14:49: error: 'accumulate' cannot be used as a function
   14 |   cout << accumulate(x)/n << ' ' << accumulate(y)/n << '\n';
      |                                                 ^