catdog.cpp: In function 'void reset()':
catdog.cpp:11:58: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
11 | for(int i=1; i<=n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 1e6;
| ~~~~~~~^
catdog.cpp: In function 'int query()':
catdog.cpp:16:35: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
16 | if(val[1] == 2) return dp[1][2];
| ~~~~~~~^
catdog.cpp: In function 'void dfs(int, int)':
catdog.cpp:21:28: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
21 | if(val[u] != 1) dp[u][2] = 0;
| ~~~~~~~^
catdog.cpp:27:48: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
27 | if(val[u] != 1) dp[u][2] += min(dp[v][2], dp[v][1] + 1);
| ~~~~~~~^
catdog.cpp:27:34: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
27 | if(val[u] != 1) dp[u][2] += min(dp[v][2], dp[v][1] + 1);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
catdog.cpp:27:34: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
catdog.cpp:28:58: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
28 | if(val[u] != 2) dp[u][1] += min(dp[v][1], dp[v][2] + 1);
| ~~~~~~~^
catdog.cpp: In function 'int cat(int)':
catdog.cpp:11:58: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
11 | for(int i=1; i<=n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 1e6;
| ~~~~~~~^
catdog.cpp:16:35: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
16 | if(val[1] == 2) return dp[1][2];
| ~~~~~~~^
catdog.cpp: In function 'int dog(int)':
catdog.cpp:11:58: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
11 | for(int i=1; i<=n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 1e6;
| ~~~~~~~^
catdog.cpp:16:35: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
16 | if(val[1] == 2) return dp[1][2];
| ~~~~~~~^
catdog.cpp: In function 'int neighbor(int)':
catdog.cpp:11:58: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
11 | for(int i=1; i<=n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 1e6;
| ~~~~~~~^
catdog.cpp:16:35: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
16 | if(val[1] == 2) return dp[1][2];
| ~~~~~~~^