| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1315793 | jesusarg | Hack (APIO25_hack) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
using namespace std;
ll calc(ll k, ll n){
ll q=100000/n;
long long r=k%n;
return r*(q*(q+1)/2)+(n-r)*(q*(q-1)/2);
}
int hack(){
vector<ll> x(100000);
for(int i=0; i<100000; i++){
x[i] = i+1;
}
ll val = collisions(x);
if(val>0){
ll lo=2, hi=100000,ans=100000;
while(lo<=hi){
ll mid=lo+((hi-lo)>>1);
if(calc(100000,mid)>=val){
ans=mid;
lo=mid+1;
}else{
hi=mid-1;
}
}
return ans;
}
}
