Submission #1315793

#TimeUsernameProblemLanguageResultExecution timeMemory
1315793jesusargHack (APIO25_hack)C++20
Compilation error
0 ms0 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;
    } 
}

Compilation message (stderr)

hack.cpp: In function 'int hack()':
hack.cpp:17:14: error: 'collisions' was not declared in this scope
   17 |     ll val = collisions(x);
      |              ^~~~~~~~~~
hack.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^