Problem railway
User weccs
Submission Time 2026-09-26 15:30:12
Score 0
Max Time N/A
Max Memory N/A

Compile Error

railway.cpp: In function ‘void dfs(int, int)’:
railway.cpp:14:5: error: invalid types ‘int[int]’ for array subscript
14 | p[x][0] = p;
| ^
railway.cpp:19:7: error: cannot convert ‘std::pair<int, int>’ to ‘int’
19 | dfs(i,x);
| ^
| |
| std::pair<int, int>
railway.cpp:13:14: note: initializing argument 1 of ‘void dfs(int, int)’
13 | void dfs(int x, int p) {
| ~~~~^
railway.cpp: In function ‘void findpa(int, int)’:
railway.cpp:30:9: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
30 | return x;
| ^
railway.cpp: In function ‘int lca(int, int)’:
railway.cpp:35:12: error: void value not ignored as it ought to be
35 | a = findpa(a,depth[a]-depth[b]);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
railway.cpp: In function ‘int main()’:
railway.cpp:61:26: error: ‘i’ was not declared in this scope