Submission #720372

#TimeUsernameProblemLanguageResultExecution timeMemory
720372ismayilDigital Circuit (IOI22_circuit)C++17
Compilation error
0 ms0 KiB
#include "circuit.h" #include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int MAX = 3e3; int dp[2][MAX]; vector<int> adj[MAX]; int n, m; void init(int N, int M, vector<int> P, vector<int> A) { n = N, m = M; for(int i = 0; i < N + M; i++){ if(P[i] == -1) continue; adj[P[i]].push_back(i); } for(int i = 0; i < M; i++){ dp[A[i]][i + n] = 1; } } void dfs(int u){ if(u >= n) return; int l = -1, r = -1; for(auto v : adj[u]){ dfs(v); if(l == -1) l = v; else r = v; } dp[0][u] = dp[0][l] * dp[1][r] + dp[1][l] * dp[0][r] + 2 * dp[0][l] * dp[0][r]; dp[1][u] = dp[0][l] * dp[1][r] + dp[1][l] * dp[0][r] + 2 * dp[1][l] * dp[1][r]; } int count_ways(int L, int R) { for(int i = L; i <= R; i++){ dp[0][i] = 1 - dp[0][i]; dp[1][i] = 1 - dp[1][i]; } dfs(0); return dp[1][0]; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccofjPOm.o: in function `main':
stub.cpp:(.text.startup+0x128): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x169): undefined reference to `count_ways(int, int)'
collect2: error: ld returned 1 exit status