Submission #803193

#TimeUsernameProblemLanguageResultExecution timeMemory
803193yeysoDigital Circuit (IOI22_circuit)C++17
Compilation error
0 ms0 KiB
#include "circuit.h" #include <bits/stdc++.h> using namespace std; long long mod = 1e9+2022; #include <vector> vector<long long> dp0; vector<long long> dp1; vector<vector<long long>> adj; void dfs(long long u, long long v){ //cout << u << " "; if(adj[u].size() == 2){ long long l = adj[u][0]; long long r = adj[u][1]; dfs(l, u); dfs(r, u); dp0[u] = dp1[l] * dp0[r] + dp1[r] * dp0[l] + 2 * dp0[l] * dp0[r]; dp1[u] = dp1[l] * dp0[r] + dp1[r] * dp0[l] + 2 * dp1[l] * dp1[r]; } else { } } long long n, m; void init(long long N, long long M, vector<long long> P, vector<long long> A) { n = N; m = M; dp0.resize(N+M, 0); dp1.resize(N+M, 0); for(long long i = 0; i < A.size(); i ++){ dp0[i+N] = A[i] ^ 1; dp1[i+N] = A[i]; } //for(long long i = 0; i < dp1.size(); i ++){ //cout << dp1[i] << " "; //} cout << "\n"; vector<vector<long long>> adj0(N, vector<long long>()); for(long long i = 0; i < P.size(); i ++){ //adj0[i].push_back(P[i]); if(i != 0) adj0[P[i]].push_back(i); } adj = adj0; } long long count_ways(long long L, long long R) { //return 0; for(long long i = L; i <= R; i ++){ dp0[i] = dp0[i] ^ 1; dp1[i] = dp1[i] ^ 1; } dfs(0, 0); //for(long long i = 0; i < dp1.size(); i ++) cout << dp1[i] << " "; //cout << " | "; return dp1[0]; } /* g++ -std=gnu++17 -O2 -Wall -pipe -static -o circuit stub.cpp circuit.cpp dp1[i] = dp1[u] * dp0[v] + dp0[u] * dp1[v] + 2 * dp1[u] * dp1[v] 3 4 3 -1 0 1 2 1 1 0 1 0 1 0 3 4 4 5 3 6 */

Compilation message (stderr)

circuit.cpp: In function 'void init(long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
circuit.cpp:30:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(long long i = 0; i < A.size(); i ++){
      |                          ~~^~~~~~~~~~
circuit.cpp:39:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(long long i = 0; i < P.size(); i ++){
      |                          ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccuWyEhy.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