Submission #1207045

#TimeUsernameProblemLanguageResultExecution timeMemory
1207045alterioHack (APIO25_hack)C++20
0 / 100
71 ms16228 KiB
#include "hack.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll C(ll x) {
    return (x * (x + 1)) / 2;
}

int hack() {
    vector<ll> x;
    for (int i = 1; i <= 1e6; i++) x.push_back(i);
    ll get = collisions(x);
    for (ll sz = 2; sz <= 1e6; sz++) {
        ll l = 0, r = 1e6 + 1;
        while (l + 1 < r) {
            ll mid = (l + r) / 2;
            if (sz * C(mid) <= get) l = mid;
            else r = mid;
        }
        ll rest = get - sz * C(l);
        if (rest % l == 0) return sz;
    }
}

Compilation message (stderr)

hack.cpp: In function 'int hack()':
hack.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...