QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#135211 | #6634. Central Subset | wtn135687# | Compile Error | / | / | C++14 | 1.3kb | 2023-08-05 12:53:07 | 2023-08-05 12:53:08 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-08-05 12:53:08]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-05 12:53:07]
- 提交
answer
#include<bits/stdc++.h>
#define pll pair<ll, ll>
using namespace std;
typedef long long ll;
#define int ll
const int N = 2e5+10;
const int M = 1e6 + 7;
int n, m, fa[N], mx;
vector<ll> edge[N], ans;
bool vis[N];
void init(){
// ans.clear();
for (int i = 0; i <= n; i++) edge[i].clear(),vis[i]=0;
ok=1;
ans.clear();
mx = sqrt(n);
if (mx * mx < n)mx++;
}
int ok=1;
int dfs(int u){
int dis=0;
vis[u]=1;
for(int v:edge[u]){
if(vis[v])continue;
// vis[v]=1;
dis=max((dfs(v)+1),dis);
}
// cout<<"u->"<<u<<" dis->"<<dis<<endl;
if(dis==mx){
ans.push_back(u);
if(u==1){
ok=0;
}
return -1;
}
return dis;
}
inline void solve(){
cin >> n >> m;
init();
for (int i = 1, u, v; i <= m; i++){
cin >> u >> v;
edge[u].push_back(v);
edge[v].push_back(u);
}
// cout<<"mx->"<<mx<<endl;
// ans.push_back(1);
if(ok){
ans.push_back(1);
}
sort(ans.begin(),ans.end());
cout<<ans.size()<<"\n";for(int i:ans)cout<<i<<" ";cout<<"\n";
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int WTN666=1;cin>>WTN666;
while(WTN666--){
solve();
}
}
详细
answer.code: In function ‘void init()’: answer.code:16:5: error: ‘ok’ was not declared in this scope 16 | ok=1; | ^~