Submission #1246075

#TimeUsernameProblemLanguageResultExecution timeMemory
1246075KALARRYHack (APIO25_hack)C++20
Compilation error
0 ms0 KiB
//chockolateman
#include<bits/stdc++.h>
#include <vector>
#include "hack.h"

using namespace std;

map<long long,bool> done;
map<long long,long long> memo;
vector<int> nums;

long long query(long long x)
{
    if(done[x])
        return memo[x];
    done[x] = true;
    vector<long long> temp;
    temp.push_back(1);
    temp.push_back(1+x);
    memo[x] = collisions(temp);
    return memo[x];
}

int hack(){
    done.clear();
    memo.clear();
    std::vector<long long> temp;
    bool broke = false;
    int counter = -1;
    if(nums.empty())
        for(int i = 1 ; i <= 500000 ; i++)
            nums.push_back(i);
    random_shuffle(nums.begin(),nums.end());
    while(!broke)
    {
        temp.clear();
        counter++;
        temp.push_back(1);
        temp.push_back(1 + nums[counter]);
        if(query(nums[counter]))
            broke = true;
    }
    int n = nums[counter];
    for(int x = 1 ; x <= n ; x++)
        if(n%x==0)
        {
            temp.clear();
            temp.push_back(1);
            temp.push_back(1 + x);
            if(query(temp))
                n = x;
        }
    return n;
}

Compilation message (stderr)

hack.cpp: In function 'int hack()':
hack.cpp:50:22: error: cannot convert 'std::vector<long long int>' to 'long long int'
   50 |             if(query(temp))
      |                      ^~~~
      |                      |
      |                      std::vector<long long int>
hack.cpp:12:27: note:   initializing argument 1 of 'long long int query(long long int)'
   12 | long long query(long long x)
      |                 ~~~~~~~~~~^