제출 #31498

#제출 시각아이디문제언어결과실행 시간메모리
31498YoLo어르신 집배원 (BOI14_postmen)C++14
38 / 100
1087 ms26616 KiB
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second #define int long long #define endl '\n' #define N 100000 #define pi acos(-1) #define tora acos(-1)/180 #define tode 180/acos(-1) #define pque priority_queue typedef pair < int, int > ii; typedef vector < int > vi; typedef vector < vi > vii; int mod = 1000000007 ; int check[500009], edge[500009], n, m, a, b; vector<ii> v[500009]; stack<int> st; void dfs(int u) { //cout << u << endl; if(check[u] == 1) { while(!st.empty()) { int id = st.top(); cout << id << ' '; check[id] = 0; st.pop(); if(id == u) break; } cout << endl; } check[u] = 1; st.push(u); for(int i = 0; i < v[u].size(); i++) if(edge[v[u][i].se] == 0 && check[u] == 1) edge[v[u][i].se] = 1, dfs(v[u][i].fi); } signed main() { //ios_base::sync_with_stdio(0); cin >> n >> m; for(int i = 1; i <= m; i++) { cin >> a >> b; v[a].pb(mp(b, i)); v[b].pb(mp(a, i)); } for(int i = 1; i <= n; i++) dfs(i); }

컴파일 시 표준 에러 (stderr) 메시지

postmen.cpp: In function 'void dfs(long long int)':
postmen.cpp:39:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < v[u].size(); i++)
                 ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...