# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027107 | 2024-07-18T21:39:18 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; vector<int> a; vector<pii> p; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>m; for(k=0; k<n; k++){ int x,y; cin>>x>>y; p.pb({y,x}); } for(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; }#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[k][1]=x; p[k][0]=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:34:2: error: stray '#' in program 34 | }#include <bits/stdc++.h> | ^ joi2019_ho_t2.cpp:34:3: error: 'include' does not name a type 34 | }#include <bits/stdc++.h> | ^~~~~~~ joi2019_ho_t2.cpp:42:11: error: redefinition of 'const int N' 42 | const int N=2*1e5; | ^ joi2019_ho_t2.cpp:9:11: note: 'const int N' previously defined here 9 | const int N=2*1e5; | ^ joi2019_ho_t2.cpp:43:5: error: redefinition of 'int n' 43 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:10:5: note: 'int n' previously declared here 10 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:43:7: error: redefinition of 'int m' 43 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:10:7: note: 'int m' previously declared here 10 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:43:9: error: redefinition of 'int k' 43 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:10:9: note: 'int k' previously declared here 10 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:43:11: error: redefinition of 'int i' 43 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:10:11: note: 'int i' previously declared here 10 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:43:13: error: redefinition of 'int j' 43 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:10:13: note: 'int j' previously declared here 10 | int n,m,k,i,j,ans; | ^ joi2019_ho_t2.cpp:43:15: error: redefinition of 'int ans' 43 | int n,m,k,i,j,ans; | ^~~ joi2019_ho_t2.cpp:10:15: note: 'int ans' previously declared here 10 | int n,m,k,i,j,ans; | ^~~ joi2019_ho_t2.cpp:44:5: error: redefinition of 'int main()' 44 | int main() { | ^~~~ joi2019_ho_t2.cpp:13:5: note: 'int main()' previously defined here 13 | int main() { | ^~~~ joi2019_ho_t2.cpp: In function 'int main()': joi2019_ho_t2.cpp:52:15: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 52 | p[k][1]=x; p[k][0]=y; | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from joi2019_ho_t2.cpp:1: /usr/include/c++/10/bits/stl_pair.h:390:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type = const std::pair<int, int>&]' 390 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:393:41: note: no known conversion for argument 1 from 'int' to 'std::conditional<true, const std::pair<int, int>&, const std::__nonesuch&>::type' {aka 'const std::pair<int, int>&'} 390 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 391 | __and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | const pair&, const __nonesuch&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_pair.h:401:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type = std::pair<int, int>&&]' 401 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:404:31: note: no known conversion for argument 1 from 'int' to 'std::conditional<true, std::pair<int, int>&&, std::__nonesuch&&>::type' {aka 'std::pair<int, int>&&'} 401 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 402 | __and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | pair&&, __nonesuch&&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_pair.h:418:2: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 418 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:418:2: note: template argument deduction/substitution failed: joi2019_ho_t2.cpp:52:15: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 52 | p[k][1]=x; p[k][0]=y; | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from joi2019_ho_t2.cpp:1: /usr/include/c++/10/bits/stl_pair.h:430:2: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 430 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:430:2: note: template argument deduction/substitution failed: joi2019_ho_t2.cpp:52:15: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 52 | p[k][1]=x; p[k][0]=y; | ^ joi2019_ho_t2.cpp:52:26: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 52 | p[k][1]=x; p[k][0]=y; | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from joi2019_ho_t2.cpp:1: /usr/include/c++/10/bits/stl_pair.h:390:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value, const std::pair<_T1, _T2>&, const std::__nonesuch&>::type = const std::pair<int, int>&]' 390 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:393:41: note: no known conversion for argument 1 from 'int' to 'std::conditional<true, const std::pair<int, int>&, const std::__nonesuch&>::type' {aka 'const std::pair<int, int>&'} 390 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 391 | __and_<is_copy_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | is_copy_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 393 | const pair&, const __nonesuch&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_pair.h:401:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type) [with _T1 = int; _T2 = int; typename std::conditional<std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value, std::pair<_T1, _T2>&&, std::__nonesuch&&>::type = std::pair<int, int>&&]' 401 | operator=(typename conditional< | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:404:31: note: no known conversion for argument 1 from 'int' to 'std::conditional<true, std::pair<int, int>&&, std::__nonesuch&&>::type' {aka 'std::pair<int, int>&&'} 401 | operator=(typename conditional< | ~~~~~~~~~~~~~~~~~~~~~ 402 | __and_<is_move_assignable<_T1>, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | is_move_assignable<_T2>>::value, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 404 | pair&&, __nonesuch&&>::type __p) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_pair.h:418:2: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 418 | operator=(const pair<_U1, _U2>& __p) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:418:2: note: template argument deduction/substitution failed: joi2019_ho_t2.cpp:52:26: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 52 | p[k][1]=x; p[k][0]=y; | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from joi2019_ho_t2.cpp:1: /usr/include/c++/10/bits/stl_pair.h:430:2: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = _U1; _U2 = _U2; _T1 = int; _T2 = int]' 430 | operator=(pair<_U1, _U2>&& __p) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:430:2: note: template argument deduction/substitution failed: joi2019_ho_t2.cpp:52:26: note: mismatched types 'std::pair<_T1, _T2>' and 'int' 52 | p[k][1]=x; p[k][0]=y; | ^ joi2019_ho_t2.cpp:59:9: error: request for member 'rbegin' in 'p', which is of non-class type 'std::vector<std::pair<int, int> > [2]' 59 | sort(p.rbegin(),p.rend()); | ^~~~~~ joi2019_ho_t2.cpp:59:20: error: request for member 'rend' in 'p', which is of non-class type 'std::vector<std::pair<int, int> > [2]' 59 | sort(p.rbegin(),p.rend()); | ^~~~ joi2019_ho_t2.cpp:40:12: error: 'class std::vector<std::pair<int, int> >' has no member named 'second' 40 | #define ss second | ^~~~~~ joi2019_ho_t2.cpp:63:11: note: in expansion of macro 'ss' 63 | if(p[k].ss<=a[ans])ans++; | ^~