Submission #1341177

#TimeUsernameProblemLanguageResultExecution timeMemory
1341177JuanJLGift Exchange (JOI24_ho_t4)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define fst first
#define snd second
#define pb push_back
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
#define forn(i,a,b) for(int i = a; i<b; i++)
#define mset(a,v) memset(a,v,sizeof(a))
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template< typename T >
using iset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;


int main(){ 
	ll n; cin>>n;
	vector<ll> a(n); forn(i,0,n) cin>>a[i];
	vector<ll> b(n); forn(i,0,n) cin>>b[i];

	vector<ll> bads; forn(i,1,n){
		if(b[i]>a[i-1]) bads.insert(i);
	}
	ll q; cin>>q;
	forn(iqq,0,q){
		ll l,r; cin>>l>>r; l--; r--;

		
		bool yes = true;

		ll i = lower_bound(ALL(bads),l)-bads.begin();
		if(i!=SZ(bads) && bads[i]<=r){
			yes=false;
		}
		
		if(yes) cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:26:44: error: no matching function for call to 'std::vector<long long int>::insert(int&)'
   26 |                 if(b[i]>a[i-1]) bads.insert(i);
      |                                 ~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from Main.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:1482:9: note: candidate: 'template<class _InputIterator, class> constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = long long int; _Alloc = std::allocator<long long int>]'
 1482 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1482:9: note:   template argument deduction/substitution failed:
Main.cpp:26:44: note:   candidate expects 3 arguments, 1 provided
   26 |                 if(b[i]>a[i-1]) bads.insert(i);
      |                                 ~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:72:
/usr/include/c++/13/bits/vector.tcc:133:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:133:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/13/bits/stl_vector.h:1393:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; value_type = long long int]'
 1393 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1393:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/13/bits/stl_vector.h:1411:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1411 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1411:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/13/bits/stl_vector.h:1437:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator; size_type = long unsigned int; value_type = long long int]'
 1437 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1437:7: note:   candidate expects 3 arguments, 1 provided