Skip to content

Commit

Permalink
chore: day7 hard
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshu2003 committed Apr 11, 2024
1 parent bf4bd1d commit 403a85f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Hard/Day7/Problem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
In a fantastical underwater city, shimmering coral castles rose from the sandy seabed.
Each castle, numbered from 1 to n, boasted a luminous hue, distinct from its neighbors.
Legends whispered of magical currents, known as "glimmering streams," that flowed through this dazzling metropolis.
But only the most astute merfolk could navigate them.

These glimmering streams possessed three unique properties:

->A Luminescent Journey: The current had to flow through at least two castles, ensuring a proper underwater voyage.

->Twin Beacons: The starting and ending castles had to be bathed in the same mesmerizing light, like a journey returning to its source.

->A Kaleidoscope of Color: No other castle along the current could be bathed in the starting light. The path needed to explore the vibrant tapestry of colors, avoiding familiar territory.
Count the number of the glimmering streams of the fantastical underwater city.

The first line contains a single integer t (1≤t≤10^4) — the number of testcases.

The first line of each testcase contains a single integer n (2≤n≤2⋅10^5) — the number of castle in the fantastical underwater city.

The second line contains n integers d1,d2,…,dn(1≤di≤n) — the color of each castle.

The i-th of the next n−1 lines contains two integers ai and bi (1≤ai,bi≤n; ai≠bi) — the i-th edge of the the fantastical underwater city.

11 changes: 11 additions & 0 deletions Hard/Day7/Sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Input
1
5
1 2 3 4 5
1 2
1 3
3 4
4 5

Output
0
1 change: 1 addition & 0 deletions Hard/Day7/Solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Write Your Code Here

0 comments on commit 403a85f

Please sign in to comment.