제출 #777588

#제출 시각아이디문제언어결과실행 시간메모리
777588MasterTaster어르신 집배원 (BOI14_postmen)C++14
55 / 100
682 ms77320 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define xx first #define yy second #define pb push_back #define MAXN 500003 using namespace std; int n, m; //deg[MAXN] vector<int> put, tren; set<int> g[MAXN]; bool bio[MAXN]; int main(){ cin>>n>>m; for (int i=0; i<m; i++) { int u, v; cin>>u>>v; g[u].insert(v); g[v].insert(u); //deg[u]++; //deg[v]++; } //cout<<"ee"<<endl; stack<int> st; st.push(1); while (!st.empty()) { int u=st.top(); if (g[u].empty()) { put.pb(u); st.pop(); continue; } int v=(*g[u].begin()); g[u].erase(v); g[v].erase(u); //deg[u]--; //deg[v]--; st.push(v); } //for (auto x:put) cout<<x<<" "; //cout<<endl; for (int i=0; i<put.size(); i++) { int u=put[i]; st.push(u); if (bio[u]) { tren.clear(); int nes=0; while (!nes || st.top()!=u) { nes++; bio[st.top()]=false; tren.pb(st.top()); st.pop(); } for (auto x:tren) cout<<x<<" "; cout<<endl; } bio[u]=true; } cout<<endl; }

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

postmen.cpp: In function 'int main()':
postmen.cpp:52:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |  for (int i=0; i<put.size(); i++)
      |                ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...