直接上代码: #include <iostream> #include <vector> using namespace std; const int n=...; // 范围 vector<bool> vis(