D题dfs即可 #define ll long long #define mod 998244353 #define int ll using namespace std; bool st[1000010]; vector<int >q[1000010]; int n,x,y; int d[1000010][2]; int dfs(int k,int h) //0 wu 1teshu { if(d[k][h]) return d[k][h]; st[k]=1; int ans=0; int f=0; int num1=1,num2...