Here is a Problem: 2069B - Set of Strangers Here is Soln: 306760751
# | User | Rating |
---|---|---|
1 | tourist | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 158 |
5 | atcoder_official | 156 |
6 | adamant | 152 |
6 | djm03178 | 152 |
8 | Qingyu | 151 |
9 | luogu_official | 149 |
10 | awoo | 147 |
Here is a Problem: 2069B - Set of Strangers Here is Soln: 306760751
Name |
---|
CounterEX
1
4 4
1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4
output : 12
ans : 6
Any number in any arrangement can be changed into any other number with one or at most two changes.
Thanks for helping, i understood it in wrong way. I thought we have to pick same color from unconnected component and then in one move we can color these to any other color
Bro tune third question 2069C - Beautiful Sequence,dp ka implementation kaise kiya hai yeh bata sakta hai , like approach mujhe bhi aagayi thi but i don't know how to implement it
good subsequences are of form 12222....3. count of 2s >= 1 and start me 1 and end me 3.
// dp[i][1] bolega no of subsequences of form "1" till i // dp[i][2] bolega no of subsequences of form "122...." till i // dp[i][3] bolega no of subsequences of form "12....3" till i
// dp[i][1] ,agar a[i] == 1, dp[i][1] = 1 + dp[i-1][1], nhi toh base dp[i][1] = dp[i-1][1]
// dp[i][2], agar a[i] != 2 toh dp[i][2] = dp[i-1][2] // but if a[i] == 2 // i-1 tak jo already 12... bangayi ume 2 jod de, ya mat jod. total 2 * dp[i-1][2] hojayengi // i-1 tak jo no of form "1" ki subsequences hai unme 2 jod de, toh dp[i — 1][1] // so dp[i][2] = dp[i — 1][1] + 2 * dp[i — 1][2]
//dp[i][3], i-1 tak jo already 12.... bangayi unme 3 jod de bas, dp[i][3] = dp[i-1][2]
very thanks bhai , from now i will post my each doubt in community it is very helpful