Submission #1027109

# Submission time Handle Problem Language Result Execution time Memory
1027109 2024-07-18T21:41:20 Z giorgi_pkhaladze Exhibition (JOI19_ho_t2) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
using namespace std;
const int N=2*1e5;
int n,m,k,i,j,ans;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	cin>>n>>m;
  vector<int> a(m);
	vector<pii> p[2];
	for(int k=0; k<n; k++){
		int x,y; cin>>x>>y;
      p[1].pb(x); p[k][0].pb(y);
	}
	for(int k=0; k<m; k++){
		int x;
		cin>>x;
		a.pb(x);
	}
	sort(p.rbegin(),p.rend());
	sort(a.rbegin(),a.rend());
	ans=0;
	for(k=0; k<n; k++){
		if(p[k].ss<=a[ans])ans++;
	}
	cout<<ans;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:19:16: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int&)'
   19 |       p[1].pb(x); p[k][0].pb(y);
      |                ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from joi2019_ho_t2.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'int' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
joi2019_ho_t2.cpp:5:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
    5 | #define pb push_back
      |            ^~~~~~~~~
joi2019_ho_t2.cpp:19:27: note: in expansion of macro 'pb'
   19 |       p[1].pb(x); p[k][0].pb(y);
      |                           ^~
joi2019_ho_t2.cpp:26:9: error: request for member 'rbegin' in 'p', which is of non-class type 'std::vector<std::pair<int, int> > [2]'
   26 |  sort(p.rbegin(),p.rend());
      |         ^~~~~~
joi2019_ho_t2.cpp:26:20: error: request for member 'rend' in 'p', which is of non-class type 'std::vector<std::pair<int, int> > [2]'
   26 |  sort(p.rbegin(),p.rend());
      |                    ^~~~
joi2019_ho_t2.cpp:7:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
    7 | #define ss second
      |            ^~~~~~
joi2019_ho_t2.cpp:30:11: note: in expansion of macro 'ss'
   30 |   if(p[k].ss<=a[ans])ans++;
      |           ^~