이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
int n, m, a, b, t, p[500005];
bool u[500005], u2[500005];
vector<pii> v[500005];
vector<int> s, ans;
void dfs(int N){
if (u[N]){
t=-1;
ans=vector<int>();
while(t!=N){
ans.pb(t=s.back()); s.pop_back();
u[t]=0;
}
fox(l, ans.size()){
printf("%i", ans[l]);
if (l!=ans.size()-1) printf(" ");
} printf("\n");
}
while (p[N]<v[N].size() && u2[v[N][p[N]].y]) p[N]++;
if (p[N]>=v[N].size()) return;
u[N]=1;
s.pb(N);
u2[v[N][p[N]].y]=1;
++p[N];
dfs(v[N][p[N]-1].x);
}
int main(){
scan(n); scan(m);
fox(l, m){
scan(a); scan(b);
v[a].pb(mp(b, l));
v[b].pb(mp(a, l));
}
dfs(1);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
postmen.cpp: In function 'void dfs(int)':
postmen.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fox(k, x) for (int k=0; k<x; ++k)
postmen.cpp:41:13:
fox(l, ans.size()){
~~~~~~~~~~~~~
postmen.cpp:41:9: note: in expansion of macro 'fox'
fox(l, ans.size()){
^~~
postmen.cpp:43:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (l!=ans.size()-1) printf(" ");
~^~~~~~~~~~~~~~
postmen.cpp:46:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (p[N]<v[N].size() && u2[v[N][p[N]].y]) p[N]++;
~~~~^~~~~~~~~~~~
postmen.cpp:47:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (p[N]>=v[N].size()) return;
~~~~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |