Блог пользователя saptarshikuar2003

Автор saptarshikuar2003, история, 2 недели назад, По-английски

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

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
2 недели назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    Hewwo ╰(*°▽°*)╯

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    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.....