제출 #479876

#제출 시각아이디문제언어결과실행 시간메모리
479876SamAnd어르신 집배원 (BOI14_postmen)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define m_p make_pair const int N = 500005; int n, m; int z; bool c[N]; int s[N]; vector<int> a[N]; vector<int> b[N]; int vn; int v[N]; void dfs(int x) { while (s[x] != -1) { int h = a[x][s[x]]; if (c[b[x][s[x]]]) { --s[x]; continue; } c[b[x][s[x]]] = true; --s[x]; dfs(h); } v[vn++] = x; } int ka() { int x = 0; while (1) { char t = getchar(); if (t == ' ' || t == '\n') return x; x *= 10; x += (t - '0'); } } char t[10]; void tp(int x) { int tn = 0; while (x) { t[tn++] = (x % 10) + '0'; x /= 10; } for (int i = tn - 1; i >= 0; --i) putchar(t[i]); putchar(' '); } int main() { n = ka(); m = ka(); for (int i = 0; i < m; ++i) { int x, y; x = ka(); y = ka(); a[x].push_back(y); a[y].push_back(x); ++z; b[x].push_back(z); b[y].push_back(z); } for (int i = 1; i <= n; ++i) s[i] = a[i].size() - 1; dfs(1); memset(c, false, sizeof c); vecotr<int> s; for (int i = 0; i < vn; ++i) { if (c[v[i]]) { tp(v[i]); while (s.back() != v[i]) { tp(s.back()); c[s.back()] = false; s.pop_back(); } putchar('\n'); } else { s.push_back(v[i]); c[v[i]] = true; } } return 0; }

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

postmen.cpp: In function 'int main()':
postmen.cpp:78:5: error: 'vecotr' was not declared in this scope
   78 |     vecotr<int> s;
      |     ^~~~~~
postmen.cpp:78:12: error: expected primary-expression before 'int'
   78 |     vecotr<int> s;
      |            ^~~
postmen.cpp:84:22: error: request for member 'back' in 's', which is of non-class type 'int [500005]'
   84 |             while (s.back() != v[i])
      |                      ^~~~
postmen.cpp:86:22: error: request for member 'back' in 's', which is of non-class type 'int [500005]'
   86 |                 tp(s.back());
      |                      ^~~~
postmen.cpp:87:21: error: request for member 'back' in 's', which is of non-class type 'int [500005]'
   87 |                 c[s.back()] = false;
      |                     ^~~~
postmen.cpp:88:19: error: request for member 'pop_back' in 's', which is of non-class type 'int [500005]'
   88 |                 s.pop_back();
      |                   ^~~~~~~~
postmen.cpp:94:15: error: request for member 'push_back' in 's', which is of non-class type 'int [500005]'
   94 |             s.push_back(v[i]);
      |               ^~~~~~~~~