Submission #1205145

#TimeUsernameProblemLanguageResultExecution timeMemory
1205145hackstarHack (APIO25_hack)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "hack.h"
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx,avx2")
#define ll long long
#define int long long
#define pii pair<int,int>
#define vec vector
#define vi vector<int>
using namespace std;
const int INF = LLONG_MAX;

int hack(){
	int N = 1e9;
	const int S = 31623;         
	vi q(1);
	int block_end = -1;
	for(int x = S; x <= N; x += S){
		q[0] = x;
		if(collisions(q)){
			block_end = x;
			break;
		}
	}
	if(block_end == -1) block_end = N;
	int low = max(1LL, block_end - S + 1), high = block_end;
	while(low < high){
		int mid = low + (high - low) / 2;
		q[0] = mid;
		if(collisions(q))
			high = mid;
		else
			low = mid + 1;
	}
	return low;
}

void solve(){
	cout << hack();
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;           // single‐test problem
	while(t--){
		solve();
	}
	return 0;
}

Compilation message (stderr)

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