Submission #876280

#TimeUsernameProblemLanguageResultExecution timeMemory
876280HalfjuiceDigital Circuit (IOI22_circuit)C++17
Compilation error
0 ms0 KiB
#include <vector> struct _Node { _Node* parent; std::vector<_Node*> children; } Node; void init(int N, int M, int[] P, int[] A) { Node[] nodes = new Node[N+M]; for (int i=0; i<N+M; i++) { nodes[i].parent = nodes+P[i]; nodes[P[i]].children.push_back(nodes+i); } } int count_ways(int L, int R) { return 0; }

Compilation message (stderr)

circuit.cpp:8:31: error: expected ',' or '...' before 'P'
    8 | void init(int N, int M, int[] P, int[] A) {
      |                               ^
circuit.cpp: In function 'void init(int, int, int*)':
circuit.cpp:9:8: error: expected primary-expression before ']' token
    9 |   Node[] nodes = new Node[N+M];
      |        ^
circuit.cpp:11:5: error: 'nodes' was not declared in this scope
   11 |     nodes[i].parent = nodes+P[i];
      |     ^~~~~
circuit.cpp:11:29: error: 'P' was not declared in this scope
   11 |     nodes[i].parent = nodes+P[i];
      |                             ^