传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2083
水题不解释
Code:
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
vector<int>v[maxn];
int n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
int x;scanf("%d",&x);
v[x].push_back(i);
}int m;scanf("%d",&m);
while(m--){
int ok=1;
int len;scanf("%d",&len);
int last=0;
for(int i=1;i<=len;i++){
int x;scanf("%d",&x);
if(!ok)continue;
vector<int>::iterator it=upper_bound(v[x].begin(),v[x].end(),last);
if(it==v[x].end()){ok=0;}
if(ok)last=*it;
}if(ok)puts("TAK");else puts("NIE");
}
return 0;
}