QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#174152 | #6634. Central Subset | Klaus26# | Compile Error | / | / | C++20 | 1.2kb | 2023-09-10 04:45:29 | 2023-09-10 04:45:30 |
Judging History
This is the latest submission verdict.
- [2023-09-10 04:45:30]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-09-10 04:45:29]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug.h"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
const int N = 2e5+10;
vector<int> g[N];
int vis[N];
int n, m, lim;
void cl(){
for(int i=1; i<=n; i++){
g[i].clear();
vis[i] = 0;
}
}
bool visitado2[N+3];
vector<int>cuales;
void dfs(int u, int dis){
if(dis > lim) return;
visitado2[u] = true;
cuales.pb(u);
vis[u] = 1;
for(auto& v : g[u]){
if(visitado2[v])continue;
dfs(v,u,dis+1);
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int T;
cin>>T;
memset(visitado2, false, sizeof visitado2);
while(T--){
cin>>n>>m;
lim = sqrt(n);
while(true){
if(lim * lim >= n )break;
lim++;
}
debug(lim);
for(int i=0; i<m; i++){
int u, v;
cin>>u>>v;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> ans;
for(int i=1; i<=n; i++){
if(vis[i])continue;
ans.push_back(i);
dfs(i,0);
for(auto i : cuales)visitado2[i] = false;
cuales.clear();
}
cout<<ans.size()<<'\n';
for(auto& i : ans) cout<<i<<' ';
cout<<'\n';
cl();
}
return 0;
}
詳細信息
answer.code: In function ‘void dfs(int, int)’: answer.code:32:16: error: ‘class std::vector<int>’ has no member named ‘pb’ 32 | cuales.pb(u); | ^~ answer.code:36:20: error: too many arguments to function ‘void dfs(int, int)’ 36 | dfs(v,u,dis+1); | ~~~^~~~~~~~~~~ answer.code:29:6: note: declared here 29 | void dfs(int u, int dis){ | ^~~