TG T2 magic
因为我太菜了,所以写了个暴力,但是洛谷RE爆零,CCF那却没事,这是什么情况呢?
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline void read(int &x)
{
x=0;int flag(1);char c(0);
for(;!isdigit(c);c=getchar())if(c=='-')flag=-1;
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
x*=flag;
}
int a[105];
vector<int>G[105];
map<int,map<ll,int> >f;
int n,m,q,u,v,max_day(-1);
int main()
{
// freopen("magic.in","r",stdin);
// freopen("magic.out","w",stdout);
read(n);read(m);read(q);
for(register int i(1);i<=n;++i)
{
read(f[i][0]);
}
for(register int i(1);i<=m;++i)
{
read(u);read(v);
G[u].push_back(v);
G[v].push_back(u);
}
for(register int i(1);i<=q;++i)
{
read(a[i]);
max_day=max(max_day,a[i]);
}
for(register int i(1);i<=max_day;++i)
{
for(register int u(1);u<=n;++u)
{
f[u][i]=f[G[u][0]][i-1];
int siz=G[u].size();
for(register int j(1);j<siz;++j)
{
f[u][i]^=f[G[u][j]][i-1];
}
}
}
for(register int i(1);i<=q;++i)
{
printf("%d\n",f[1][a[i]]);
}
return 0;
}