제출 #861258

#제출 시각아이디문제언어결과실행 시간메모리
861258qwusha어르신 집배원 (BOI14_postmen)C++17
55 / 100
544 ms113096 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma gcc optimize("Ofast") using namespace std; typedef long long ll; #define fi first #define se second typedef long double ld; const ll inf = 1e9; const ld eps = 1e-8; vector<multiset<int>> g; vector<vector<int>> ans; vector<bool> used; vector<int> cur; vector<int> stcur; vector<int> res; void dfs(int v) { if (stcur[v] > 0) { res.clear(); while(cur.back() != v) { stcur[cur.back()]--; res.push_back(cur.back()); cur.pop_back(); } stcur[cur.back()]--; res.push_back(cur.back()); cur.pop_back(); ans.push_back(res); } if (v == 4) { int x = 1; } while (!g[v].empty()) { cur.push_back(v); stcur[v]++; auto t = g[v].begin(); int u = *t; g[v].erase(t); g[u].erase(g[u].find(v)); dfs(u); } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; used.resize(n); g.resize(n); for (int i = 0; i < m; i++) { int v, u; cin >> v >> u; g[v - 1].insert(u - 1); g[u - 1].insert(v - 1); } stcur.resize(n); dfs(0); for (auto s : ans) { for (auto el : s) { cout << el + 1 << ' '; } cout << '\n'; } }

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

postmen.cpp:4: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    4 | #pragma gcc optimize("Ofast")
      | 
postmen.cpp: In function 'void dfs(int)':
postmen.cpp:33:13: warning: unused variable 'x' [-Wunused-variable]
   33 |         int x = 1;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...