제출 #998113

#제출 시각아이디문제언어결과실행 시간메모리
998113Trisanu_Das9월 (APIO24_september)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e5 + 5; const int MAX_M = 15; class UnionFind { private: vector<int> parent, size; public: UnionFind(int n) : parent(n), size(n, 1) { iota(parent.begin(), parent.end(), 0); } int find(int v) { if (parent[v] == v) return v; return parent[v] = find(parent[v]); } void unite(int a, int b) { a = find(a); b = find(b); if (a != b) { if (size[a] < size[b]) swap(a, b); parent[b] = a; size[a] += size[b]; } } int getSize(int v) { return size[find(v)]; } }; int solve(int n, int m, const vector<int>& F, const vector<vector<int>>& S) { vector<vector<int>> graph(n); vector<UnionFind> uf(m, UnionFind(n)); vector<set<int>> elements(m); for (int i = 1; i < n; ++i) { graph[i].push_back(F[i]); graph[F[i]].push_back(i); } int answer = 0; for (int i = n - 2; i >= 0; --i) { bool isValid = true; for (int j = 0; j < m; ++j) { int x = S[j][i]; elements[j].insert(x); for (int neighbor : graph[x]) { if (elements[j].count(neighbor)) { uf[j].unite(x, neighbor); } } if (uf[j].getSize(x) != n - i) { isValid = false; } } if (n <= 1000) { for (int j = 1; j < m; ++j) { if (elements[j] != elements[j - 1]) { isValid = false; } } } if (isValid) ++answer; } return answer; }

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

/usr/bin/ld: /tmp/ccu9C2aj.o: in function `mtbpdhr2zxjo1o4i9oreohsbuzzl4s6u::taskcase()':
grader.cpp:(.text+0x4f0): undefined reference to `solve(int, int, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status