saptarshikuar2003's blog

By saptarshikuar2003, history, 2 weeks ago, In English

hello, I got stuck in this problem can any one help me in figuring out what is the mistake. submission link:- https://codeforces.net/contest/1790/submission/296512970

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

People could figure out your mistake better if you explain your approach

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Hewwo ╰(*°▽°*)╯

  • »
    »
    2 weeks ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    actually in the question they mentioned that we can keep consecutive integers of the array in one set and we have to return what is the number of such sets that can be formed. for that I took a variable temp to check for consecutive that is (x.F-temp==1) then if x.S!=0&&(x.F-temp==1)-----> true then I continued for the nexts consecutives with temp=x.F and m[x.F]--; if at some value x.S!=0&&(x.F-temp!=1)-----> true then I only continued with temp=x.F; for further consecutive. all the left values or the value which are not consecutive they will get deduced in the first case where y==0 is mentioned
    then when all the values of the map is 0 the I break. however the solution is O(n^2) may be.....