Submission #344650

#TimeUsernameProblemLanguageResultExecution timeMemory
344650bachaquerShymbulak (IZhO14_shymbulak)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; ll n, x, m, y; vector<vector<ll>> v; ll was[1000]; ll rast = 0, mx = -1, sum = 0; void dfs (ll n) { was[n] = 1; rast++; for (int i = 0; i < v[n].size(); i++) { if (!was[i]) dfs(v[n][i]); } if (rast > mx) { mx = rast; sum = 1; } else if (rast == mx) { sum++; } rast--; was[n] = 0; } int main() { cin >> n; vector<ll> v[n]; for (int i = 0; i <= n; i++) { v.pb({}); } for (int i = 0; i < n; i++) { cin >> x >> y; v[x].pb(y); v[y].pb(x); } for (int j = 1; j <= n; j++) { dfs(j); } cout << sum; return 0; }

Compilation message (stderr)

shymbulak.cpp: In function 'void dfs(long long int)':
shymbulak.cpp:19:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int i = 0; i < v[n].size(); i++) {
      |                     ~~^~~~~~~~~~~~~
shymbulak.cpp: In function 'int main()':
shymbulak.cpp:4:12: error: request for member 'push_back' in 'v', which is of non-class type 'std::vector<long long int> [n]'
    4 | #define pb push_back
      |            ^~~~~~~~~
shymbulak.cpp:37:11: note: in expansion of macro 'pb'
   37 |         v.pb({});
      |           ^~