이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)a.size()
#define pb push_back
#define int long long
const int mxN = (int)5e5+10;
int n, m, vis[mxN], vis1[mxN], nx[mxN];
vector<pair<int,int>> v, adj[mxN];
void dfs(int s){
vis[s]=1;
while(sz(adj[s])){
auto [u,e] = adj[s].back(); adj[s].pop_back();
if(vis1[e]) continue; vis1[e]=1;
if(vis[u]==1){
int p = u;
while(vis[p]) cout<<p<<" ", vis[p]=0, p = nx[p];
cout << "\n";
}
nx[s]=u, dfs(u);
}
}
int32_t main(){
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b; cin >> a >> b;
adj[a].pb({b,i}); adj[b].pb({a,i});
}
dfs(1);
}
컴파일 시 표준 에러 (stderr) 메시지
postmen.cpp: In function 'void dfs(long long int)':
postmen.cpp:14:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
14 | if(vis1[e]) continue; vis1[e]=1;
| ^~
postmen.cpp:14:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
14 | if(vis1[e]) continue; vis1[e]=1;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |