제출 #1294668

#제출 시각아이디문제언어결과실행 시간메모리
1294668ChottuFHack (APIO25_hack)C++20
컴파일 에러
0 ms0 KiB
#include "hack.h"
#include <bits/stdc++.h>
using namespace std;

const long long BB = 22303;
const long long MAXN = 1e9;


bool query(vector<long long> A, vector<long long> B){
    for (auto u : B) A.push_back(u);
    for (auto u : A){
        //cout << u << " ";
    }
    //cout << '\n';
    long long x = collisions(A);
    return (x > 0);
}

long long hack(){
    vector<long long> A,B;
    for (long long i = 1; i<=BB; i++){
        A.push_back(i);
    }
    for (long long st = ((MAXN/2)/BB)*BB; st <= 1e9; st += BB){
        B.push_back(st);
    }
    
    while (A.size() > 1 || B.size() > 1){
        if (A.size() <= B.size()) swap(A,B); //ensures A is bigger
        //split A
        vector<long long> fst,scd;
        for (long long i = 0; i<A.size(); i++){
            if (i < A.size()/2) fst.push_back(A[i]);
            else scd.push_back(A[i]);
        }
        if (query(fst, B)){
            //it's inside here
            A.clear();
            for (auto u : fst) A.push_back(u);
        }
        else{
            A.clear();
            for (auto u : scd) A.push_back(u);
        }
    }
    long long one = A[0];
    long long two = B[0];
    long long dif = abs(one-two);
    
    vector<long long> fac;
    long long diff = dif;
    for (long long i = 2; i*i <= diff; i++){
        while (diff % i == 0){
            fac.push_back(i);
            diff /= i;
        }
    }
    if (diff > 1) fac.push_back(diff);
    
    for (auto u : fac){
        vector<long long> tst = {1, (dif/u)+1};
        if (collisions(tst)){
            dif /= u;
        }
    }
    return dif;
}

long long main(){
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

hack.cpp:19:11: error: ambiguating new declaration of 'long long int hack()'
   19 | long long hack(){
      |           ^~~~
In file included from hack.cpp:1:
hack.h:3:5: note: old declaration 'int hack()'
    3 | int hack();
      |     ^~~~
cc1plus: error: '::main' must return 'int'