Submission #1246069

#TimeUsernameProblemLanguageResultExecution timeMemory
1246069JerHack (APIO25_hack)C++20
25 / 100
1049 ms24280 KiB
#include "hack.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll MAXN = 1e6;

ll pre[MAXN + 5];

void make_pre()
{
    pre[0] = 0;
    for (ll i = 1; i <= MAXN; i++)
        pre[i] = pre[i - 1] + i;
}

int hack()
{
    vector<ll> in;
    for (ll i = 1; i <= MAXN; i++)
        in.push_back(i);

    make_pre();

    ll res = collisions(in);

    for (ll i = 1; i <= MAXN; i++)
    {
        ll exp = (i * pre[((MAXN / i) - 1)]) + ((MAXN / i) * (MAXN % i));
        if (exp == res)
            return i;
    }

    return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...