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

Автор macaquedev, история, 29 часов назад, По-английски

Hi guys!

In the last div3 I hacked a couple of submissions that used quicksort. For some reason, I'm failing this time.

305347283

This submission uses an array of primitives, then uses Array.sort() which should be hackable. My generator is as follows

std::vector<int> anti_sort(size_t n) // 2n + 1
{
    std::vector<int> res(2 * n + 1);
    std::iota(res.begin(), res.end(), 1);
    // std::reverse(res.begin(), res.end());
    for (size_t i = n; i-- > 0;)
    {
        std::swap(res[2 * i + 1], res[i + n]);
    }
    return res;
}

signed main(void)
{
    auto v = anti_sort(99999);

    cout << "1" << endl;
    cout << "199999 1" << '\n';
    for (int i=0; i<v.size(); i++) 
        cout << v[i] << endl;
    return 0;
}

Why does the hack not work? And can someone suggest a hack that WILL work?

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

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

I used the template given at https://blog.kyouko.moe/29 but I didn't bother learning the details on this. I think Array.sort is not constructed to be hacked with such a simple pattern.

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

    Thanks for hacking it for me :) I got my generator in the last contest where someone spammed this test case against loads of people, but it seems it isn't the best one. I'll use yours from now on!