Submission #565726

#TimeUsernameProblemLanguageResultExecution timeMemory
565726sidonConnecting Supertrees (IOI20_supertrees)C++17
Compilation error
0 ms0 KiB
#include "supertrees.h" #include "bits/stdc++.h" using namespace std; int construct(const vector<vector<int>> &p) { int n = size(p); vector<vector<int>> g(n, vector<int> (n)); bool vis[n] {}; for(int r = 0; r < n; ++r) if(!vis[r]) { vector<int> c; vector<vector<int>> s; for(int i = r; i < n; ++i) if(!vis[i] && p[r][i]) { vis[i] = 1; c.push_back(i); } for(int i : c) { for(int j : c) if(!p[i][j]) return 0; if(vis[i]) { s.push_back({}); for(int j : c) if(p[i][j] < 2 && vis[j]) { vis[j] = 0; s.back().push_back(j); } } } for(auto &x : s) { for(auto &y : s) for(int i : x) for(int j : y) if((x[0] != y[0]) != (p[i][j] > 1)) return 0; for(int i = 1; i < int(size(x)); ++i) g[x[i-1]][x[i]] = g[x[i]][x[i-1]] = 1; } for(int i = 0; i < int(size(s)); ++i) { int u = s[i][0], v = s[(i+1) % size(s)][0]; g[u][v] = g[v][u] = 1; } for(int i : c) vis[i] = 1; } return build(g), 1; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbDQQxq.o: in function `main':
grader.cpp:(.text.startup+0x39a): undefined reference to `construct(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status