Submission #383452

# Submission time Handle Problem Language Result Execution time Memory
383452 2021-03-29T22:57:55 Z MODDI Best Place (NOI17_bestplace) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
int main(){
	int n;
	vector<int> x, y;
	cin>>n;
	for(int i = 0; i < n; i++){
		int a, b;
		cin>>a>>b;
		x.pb(a);
		y.pb(b);
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	cout<<x[n/2]<<" "<<y[n/2]<<endl;
	return 0;
}

Compilation message

bestplace.cpp: In function 'int main()':
bestplace.cpp:5:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |  vector<int> x, y;
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from bestplace.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
bestplace.cpp:5:9: error: expected primary-expression before 'int'
    5 |  vector<int> x, y;
      |         ^~~
bestplace.cpp:6:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |  cin>>n;
      |  ^~~
      |  std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:75,
                 from bestplace.cpp:1:
/usr/include/c++/9/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;  /// Linked to standard input
      |                  ^~~
bestplace.cpp:10:3: error: 'x' was not declared in this scope
   10 |   x.pb(a);
      |   ^
bestplace.cpp:11:3: error: 'y' was not declared in this scope
   11 |   y.pb(b);
      |   ^
bestplace.cpp:13:7: error: 'x' was not declared in this scope
   13 |  sort(x.begin(), x.end());
      |       ^
bestplace.cpp:13:2: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   13 |  sort(x.begin(), x.end());
      |  ^~~~
      |  std::sort
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from bestplace.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:4887:5: note: 'std::sort' declared here
 4887 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
bestplace.cpp:14:7: error: 'y' was not declared in this scope
   14 |  sort(y.begin(), y.end());
      |       ^
bestplace.cpp:15:2: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   15 |  cout<<x[n/2]<<" "<<y[n/2]<<endl;
      |  ^~~~
      |  std::cout
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:75,
                 from bestplace.cpp:1:
/usr/include/c++/9/iostream:61:18: note: 'std::cout' declared here
   61 |   extern ostream cout;  /// Linked to standard output
      |                  ^~~~
bestplace.cpp:15:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   15 |  cout<<x[n/2]<<" "<<y[n/2]<<endl;
      |                             ^~~~
      |                             std::endl
In file included from /usr/include/c++/9/istream:39,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from bestplace.cpp:1:
/usr/include/c++/9/ostream:599:5: note: 'std::endl' declared here
  599 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~