Submission #1207067

#TimeUsernameProblemLanguageResultExecution timeMemory
1207067alterioHack (APIO25_hack)C++20
25 / 100
1484 ms16456 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 + 1) != 0) continue; ll sum = sz * (l + 1) + rest / (l + 1); if (sum == 1e6) return sz; } }

Compilation message (stderr)

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