rt,死活过不去,请问谁能帮忙康康
#include<iostream>
#include<stack>
#include<vector>
#include<cstring>
using namespace std;
char buf[1 << 20],*p1,*p2;
#define getc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,1<<20,stdin),p1 == p2)?0:*p1++)
inline int read(){
int x = 0,w = 1;
char c = 0;
while(c < '0' || c > '9'){
if(c == '-')w = -1;
c = getc();
}
while(c <= '9' && c >= '0'){
x = (x << 1) + (x << 3) + (c ^ 48);
c = getc();
}
return x * w;
}
inline void print(register int x){
if(x < 0){
x = -x;
putchar('-');
}
if(x > 9)print(x / 10);
putchar(x % 10 + 48);
}
struct node{
int v,id;
};
vector<node>g[1919810];
int n,m,cnt;
stack<int>st;
bool used[1919810],dused[1919810],ddd[1919810];
inline void dfs(int now){
for(register int i = 0;i < signed(g[now].size());++i){
node son = g[now][i];
if(used[son.id])continue;
if(son.id & 1)used[son.id] = used[son.id + 1] = 1;
else used[son.id] = used[son.id - 1] = 1;
dfs(son.v);
}
if(dused[now]){
while(st.top() != now){
print(st.top());
putchar(' ');
dused[st.top()] = 0;
st.pop();
}
print(st.top());
putchar('\n');
}
else dused[now] = 1,st.push(now);
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
n = read(),m = read();
for(register int i = 1;i <= m;++i){
register int u = read(),v = read();
g[u].push_back(node{v,++cnt});
g[v].push_back(node{u,++cnt});
}
dfs(1);
return 0;
}