Submission #777058

#TimeUsernameProblemLanguageResultExecution timeMemory
777058Trisanu_DasStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> adj[1000], U, V, labelling; int N, K, curr_tag; void dfs(int u, int p){ if(p == -1 || !labelling[p]) labelling[u] = ++curr_tag; for(int v : adj[u]) if(v != p) dfs(v, u); if(!labelling[u]) labelling[u] = ++curr_tag; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ N = n; K = k; U = u, V = v; for(int i = 0; i < n; i++) adj[i].clear(); memset(labelling, 0, sizeof(labelling)); labelling.clear(); labelling.resize(n, 0); curr_tag = 0; for(int i = 0; i < n - 1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0, -1); return labelling; } int find_next_station(int s, int t, vector<int> c){ if(c.back() < s) reverse(c.begin(), c.end()); for(int x : c) if(min(s, x) <= t && t <= max(s, x)) return x; return c.back(); }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:17:10: error: cannot convert 'std::vector<int>' to 'void*'
   17 |   memset(labelling, 0, sizeof(labelling));
      |          ^~~~~~~~~
      |          |
      |          std::vector<int>
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518,
                 from /usr/include/c++/10/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from stations.cpp:1:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   59 | __NTH (memset (void *__dest, int __ch, size_t __len))
      | ^~~~~