제출 #419665

#제출 시각아이디문제언어결과실행 시간메모리
419665VladM어르신 집배원 (BOI14_postmen)C++17
55 / 100
669 ms125380 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") int u, v, n, m; vector<int> par, vis; vector<set<int> > vec; void dfs(int v) { vis[v]=1; int p=0; for(auto to : vec[v]) { if(to==par[v]) continue; if(vis[to]==1) { vec[v].erase(to); vec[to].erase(v); while(v!=to) { p=par[v]; printf("%d ", v); vec[v].erase(p); vec[p].erase(v); vis[v]=0; par[v]=0; v=p; } printf("%d\n", v); if(vec[v].size()!=0) dfs(v); return; } par[to]=v; dfs(to); return; } return; } int main() { scanf("%d%d", &n, &m); vec.resize(n+1); par.resize(n+1); vis.resize(n+1); for(int i=1; i<=m; i++) { scanf("%d%d", &u, &v); if(vec[v].find(u)!=vec[v].end()) { printf("%d %d\n", u, v); vec[u].erase(v); vec[v].erase(u); } else { vec[u].insert(v); vec[v].insert(u); } } for(int i=1; i<=n; i++) { if(vec[i].size()!=0) { dfs(i); } } return 0; }

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

postmen.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("O3")
      | 
postmen.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization ("unroll-loops")
      | 
postmen.cpp: In function 'int main()':
postmen.cpp:49:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
postmen.cpp:55:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |         scanf("%d%d", &u, &v);
      |         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...