# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1207045 | alterio | Hack (APIO25_hack) | C++20 | 71 ms | 16228 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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |