제출 #1361784

#제출 시각아이디문제언어결과실행 시간메모리
1361784opeleklanosHack (APIO25_hack)C++20
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#include "hack.h"

#define ll long long

ll secretNum = 938572;

ll queries = 0;

// ll collisions(vector<ll> v){
//     queries+=v.size();
//     vector<ll> newV(secretNum +1, 0);
//     ll ans = 0;
//     for(auto i : v){
//         ans += newV[i%secretNum];
//         newV[i%secretNum] ++;
//     }

//     return ans;
// }

ll findAns(ll k){
    ll s = 1000000/k;
    ll ans = k * (s*(s-1)/2);
    ans += s * (1000000%k);
    return ans;
}

vector<ll> ansForBucketI(1000001, -1);
ll hack(){

    if(ansForBucketI[3] == -1){
        for(ll i = 2; i<=1000000; i++){
            ansForBucketI[i] = findAns(i);
        }
        reverse(ansForBucketI.begin(), ansForBucketI.end());
    }

    vector<ll> v;
    for(int i = 1; i<= 1000000; i++) v.push_back(i);
    ll ans = collisions(v);

    return 1000000 - (lower_bound(ansForBucketI.begin(), ansForBucketI.end(), ans) - ansForBucketI.begin());
}

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

hack.cpp:34:4: error: ambiguating new declaration of 'long long int hack()'
   34 | ll hack(){
      |    ^~~~
In file included from hack.cpp:6:
hack.h:3:5: note: old declaration 'int hack()'
    3 | int hack();
      |     ^~~~