Submission #1205205

#TimeUsernameProblemLanguageResultExecution timeMemory
1205205DJ035A Plus B (IOI23_aplusb)C++20
Compilation error
0 ms0 KiB
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MEM = 1e5 + 4;
vector<ll> smallest_sums(int N, std::vector<int> A, std::vector<int> B)
{
	ll l = 0, r = 2e9 + 7;
	ll n = N;
	while (l <= r)
	{
		ll mid = (l + r) / 2;
		ll o = 0, j = n - 1;
		for (int i = 0; i < n; i++)
		{
			for (; A[i] + B[j] > mid && j >= 0; j--);
			o += j + 1;
		}
		if (o >= n)
			r = mid - 1;
		else
			l = mid + 1;
	}
	vector<ll> ans;
	r = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j<n && A[i] + B[j] < l; j++)
		{
			ans.push_back(A[i] + B[j]);
			r++;
		}
	}
	for (int i = r; i < n; i++)
		ans.push_back(l);
	sort(ans.begin(), ans.end());
	return ans;
}

Compilation message (stderr)

aplusb.cpp:6:12: error: ambiguating new declaration of 'std::vector<long long int> smallest_sums(int, std::vector<int>, std::vector<int>)'
    6 | vector<ll> smallest_sums(int N, std::vector<int> A, std::vector<int> B)
      |            ^~~~~~~~~~~~~
In file included from aplusb.cpp:1:
aplusb.h:3:18: note: old declaration 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)'
    3 | std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B);
      |                  ^~~~~~~~~~~~~