Правка en1, от mukundagarawal9, 2025-02-21 12:32:12

In this problem my approach is — if a element is at the index at which it should be i.e , i == p[i] , then answer of index i is 1 if we have character 0 at this index otherwise if this element is in loop with another element i.e , i == p[p[i]] (for ex — 2,1) , then we will increase the answer at this index if character at this position i and character at position p[i] is 0. Now for rest all elements we can calculate number of zeros excluding previous indexes and fill the number of zeros for their answer. But i my code is giving wrong answer at testcase-2 and the testcase size is large so i cannot get the permutation at this place. my code is — https://codeforces.net/contest/2008/submission/307104614 .
Please help where i am wrong .

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский mukundagarawal9 2025-02-21 12:32:12 848 Initial revision (published)