Submission #131095

# Submission time Handle Problem Language Result Execution time Memory
131095 2019-07-16T12:56:05 Z baluteshih Long Mansion (JOI17_long_mansion) C++14
Compilation error
0 ms 0 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define ET cout << "\n"
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

vector<int> v[500005];
int L[500005],R[500005],key[500005],ls[500005];
int rm[500005],relL[500005],relR[500005];

int main()
{jizz
	int n,c,x,q,l,r;
	cin >> n;
	for(int i=1;i<n;++i)
		cin >> key[i];
	for(int i=1;i<=n;++i)
		for(cin >> c,v[i].resize(c);c--;)
			cin >> x,v[c]=x;
	for(int i=1;i<n;L[i]=ls[key[i]],++i)
		for(int j:v[i])
			ls[j]=i;
	fill(ls+1,ls+n+1,n+1),R[0]=n+1;
	for(int i=n-1;i>0;R[i]=ls[key[i]],--i)
		for(int j:v[i+1])
			ls[j]=i+1;
	for(int i=n;i>0;--i)
		for(rm[i]=i;L[rm[i]]>=i;rm[i]=rm[rm[i]+1]);
	for(int i=1;i<=n;++i)
		if(R[i-1]>rm[i])
			relL[i]=i,relR[i]=rm[i];
		else
			for(relL[i]=relL[i-1],relR[i]=max(rm[i],relR[i-1]);L[relR[i]]>=relL[i]||R[relL[i]-1]<=relR[i];)
				if(L[relR[i]]>=relL[i])
					relR[i]=rm[relR[i]+1];
				else if(R[relL[i]-1]<=relR[i])
					relL[i]=relL[relL[i]-1],relR[i]=max(relR[i],relR[relL[i]]);
	for(cin >> q;q--;)
		if(cin >> l >> r,relL[l]<=r&&relR[l]>=r)
			cout << "YES\n";
		else
			cout << "NO\n";
}

Compilation message

long_mansion.cpp: In function 'int main()':
long_mansion.cpp:29:18: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
    cin >> x,v[c]=x;
                  ^
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from long_mansion.cpp:2:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from long_mansion.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'