Submission #1315794

#TimeUsernameProblemLanguageResultExecution timeMemory
1315794jesusargHack (APIO25_hack)C++20
0 / 100
38 ms1968 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define f first #define s second using namespace std; ll collisions(vector<ll> x); 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; } }

Compilation message (stderr)

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