D is kind of a simple breadth-first search, so have not covered it, you can check my solution atcoder.jp/contests/abc361/submissions/55280719 and ask me if there is any doubt
@kashishchawla2754
17 күн бұрын
@@soumyabhattacharjee1051 understood the approach, how can we be sure about the tc, can u pls elborate
@soumyabhattacharjee1051
17 күн бұрын
@@kashishchawla2754 The total number of states are at max O(N2^N) N for choosing the i where i and i+1 are spaces and 2^N for combinations of other. Now for each space the rearrangement is O(N) so overall complexity should not be more than O(N^2*2^N) Please like and subscribe if it is helpful
Пікірлер: 5
thanks
d problem?
@soumyabhattacharjee1051
17 күн бұрын
D is kind of a simple breadth-first search, so have not covered it, you can check my solution atcoder.jp/contests/abc361/submissions/55280719 and ask me if there is any doubt
@kashishchawla2754
17 күн бұрын
@@soumyabhattacharjee1051 understood the approach, how can we be sure about the tc, can u pls elborate
@soumyabhattacharjee1051
17 күн бұрын
@@kashishchawla2754 The total number of states are at max O(N2^N) N for choosing the i where i and i+1 are spaces and 2^N for combinations of other. Now for each space the rearrangement is O(N) so overall complexity should not be more than O(N^2*2^N) Please like and subscribe if it is helpful