제출 #941132

#제출 시각아이디문제언어결과실행 시간메모리
941132Faisal_Saqib어르신 집배원 (BOI14_postmen)C++17
38 / 100
1037 ms28496 KiB
#include <bits/stdc++.h> #define F first #define S second #define pii pair<int, int> #define pb push_back using namespace std; typedef long long ll; typedef long double ld; const int N = 5e5 + 10; bool mark[N], see[N]; vector<int> adj[N]; pii e[N]; vector<int> tour, st; void dfs(int v){ for(auto i : adj[v]){ if(mark[i])continue; int u = e[i].F + e[i].S - v; mark[i] = true; dfs(u); } tour.pb(v); } int main(){ cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int n, m; scanf("%d %d", &n ,&m); for(int i=0; i<m; i++){ int u, v; scanf("%d %d", &u, &v); adj[u].pb(i); adj[v].pb(i); e[i] = {u, v}; } dfs(1); for(auto u : tour){ if(!see[u]){ see[u] = true; st.pb(u); }else{ while(st.back() != u){ printf("%d ", st.back()); see[st.back()] = false; st.pop_back(); } printf("%d\n", u); } } }

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

postmen.cpp: In function 'int main()':
postmen.cpp:33:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  int n, m; scanf("%d %d", &n ,&m);
      |            ~~~~~^~~~~~~~~~~~~~~~~
postmen.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |   int u, v; scanf("%d %d", &u, &v);
      |             ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...