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

Автор winter_s0ldier, история, 3 года назад, По-английски

I was upsolving round #726 problem E1 here is my submission I don't understand the testcase 3 --

wrong answer 1st words differ — expected: 'jgfafdabagaahhiigfdgefbeidchei...gfbcghaibibagegecdhifhgfdffedhd', found: 'jgfafdabagaahhiigfdgefbeidchei...aagdhfhbdhgigaibidegdfhiahhdhhc'

isn't the found string smaller than expected string (g > a). Can someone help me with whats going on.

Полный текст и комментарии »

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

Автор winter_s0ldier, история, 3 года назад, По-английски

I was trying to rearrange the array so that the even elements are at starting (order does not matter). I used lambda function in sort function but it is giving me segmentation error.

sort(all(arr), [](int p1, int p2){
        if(p1%2==0 && p2%2 == 0){
            
            return true;
        }
        else if(p1%2==0 && p2%2 != 0){
            
            return true;
        }
        return false;
    });

here all(x) = x.begin(), x.end() It is giving segmentation error for array size greater than 20. Can someone explain what is happening?

Полный текст и комментарии »

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