제출 #419632

#제출 시각아이디문제언어결과실행 시간메모리
419632VladM어르신 집배원 (BOI14_postmen)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") using namespace std; #define DIM 500007 int u, v, n, m, par[DIM], vis[DIM]; set<int> vec[DIM]; void dfs(int v) { vis[v]=1; for(auto to : vec[v]) { if(to==p) 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].empty()) dfs(v, par[v]); } else { par[to]=v; dfs(to, v); } break; } return; } int main() { scanf("%d%d", &n, &m); 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) { par[i]=-1; dfs(i, -1); } } return 0; }

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

postmen.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("O3")
      | 
postmen.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("unroll-loops")
      | 
postmen.cpp: In function 'void dfs(int)':
postmen.cpp:19:16: error: 'p' was not declared in this scope
   19 |         if(to==p) continue;
      |                ^
postmen.cpp:26:17: error: 'p' was not declared in this scope
   26 |                 p=par[v];
      |                 ^
postmen.cpp:35:46: error: too many arguments to function 'void dfs(int)'
   35 |             if(!vec[v].empty()) dfs(v, par[v]);
      |                                              ^
postmen.cpp:14:6: note: declared here
   14 | void dfs(int v)
      |      ^~~
postmen.cpp:40:22: error: too many arguments to function 'void dfs(int)'
   40 |             dfs(to, v);
      |                      ^
postmen.cpp:14:6: note: declared here
   14 | void dfs(int v)
      |      ^~~
postmen.cpp: In function 'int main()':
postmen.cpp:70:22: error: too many arguments to function 'void dfs(int)'
   70 |             dfs(i, -1);
      |                      ^
postmen.cpp:14:6: note: declared here
   14 | void dfs(int v)
      |      ^~~
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:52:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |         scanf("%d%d", &u, &v);
      |         ~~~~~^~~~~~~~~~~~~~~~