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

Автор macaquedev, история, 21 месяц назад, По-английски

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
  • Проголосовать: не нравится

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится +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.