제출 #1116450

#제출 시각아이디문제언어결과실행 시간메모리
1116450gustavo_d어르신 집배원 (BOI14_postmen)C++17
100 / 100
343 ms80056 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optmize("O3") const int MAXN = 5e5; struct Edge { int v, id; Edge(int _v=0, int _id=0): v(_v), id(_id) {} }; vector<Edge> adj[MAXN]; bool mark[MAXN]; bool in_eulerian[MAXN]; vector<int> eulerian; void dfs(int v) { while (!adj[v].empty()) { Edge ed = adj[v].back(); adj[v].pop_back(); if (mark[ed.id]) continue; mark[ed.id] = true; dfs(ed.v); } if (in_eulerian[v]) { int i = -1; while (i != v) { i = eulerian.back(); eulerian.pop_back(); in_eulerian[i] = false; cout << i+1 << ' '; } cout << '\n'; } in_eulerian[v] = true; eulerian.push_back(v); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; for (int i=0; i<m; i++) { int u, v; cin >> u >> v; u--; v--; adj[u].push_back(Edge(v, i)); adj[v].push_back(Edge(u, i)); } for (int i=0; i<n; i++) { if (!adj[i].empty()) dfs(i); } return 0; }

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

postmen.cpp:4: warning: ignoring '#pragma GCC optmize' [-Wunknown-pragmas]
    4 | #pragma GCC optmize("O3")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...