#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,M,Q; int A[202020]; vector> T[202020]; vector ev[202020]; void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>M; FOR(i,M) { cin>>A[i]; A[i]--; T[i].push_back({0,0}); } cin>>Q; FOR(i,Q) { cin>>x; T[x-1].push_back({i+1,0}); } FOR(i,M) { int cur=A[i]; if(i==0) { FOR(x,T[i].size()) if(x) { T[i][x].second=T[i][x-1].second; if(T[i][x].second>0) T[i][x].second--; else T[i][x].second++; if(T[i][x].second>=N) return _P("NO\n"); } } else { int mi=A[i-1]; x=0; y=0; while(x0) { if(t.second=N) return _P("NO\n"); t.second=cur; } } } cout<<"YES"<