MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / solve

Function solve

Data Structures/Persistent Trie.cpp:61–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void solve() {
62 int n, q;
63 scanf("%d %d", &n, &q);
64 last = 0;
65 for (int i = 0; i < n; ++i) {
66 int a;
67 scanf("%d", &a);
68 insert(a, i);
69 }
70 while (q--) {
71 int x, l, r;
72 scanf("%d %d %d", &x, &l, &r);
73 --l, --r;
74 printf("%d\n", query(version[r], ~x, l));
75 // Trie version[r] contains the trie for [0...r] elements
76 }
77}
78// credit: mochow13

Callers

nothing calls this directly

Calls 2

insertFunction · 0.70
queryFunction · 0.70

Tested by

no test coverage detected