답안 #926393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
926393 2024-02-12T21:32:51 Z midi A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define vc vector
typedef vc<ll> vcll;
typedef vc<bool> vcb;
#define pr pair
typedef pr<ll, ll> prll;
typedef map<ll,ll> mapll;
typedef unordered_map<ll,ll> umapll;

#define f0r(i,a,n) for ((i)=(a); (i)<=(n); (i)++)
#define r0f(i,n,a) for ((i)=(n); (i)>=(a); (i)--)

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define fi first
#define se second
#define sz size
#define all(x) (x).begin(), (x).end()
#define all0(x, n) (x).begin(), (x).begin()+n
#define all1(x, n) (x).begin()+1, (x).begin()+n+1
#define allrev(x) (x).rbegin(), (x).rend()
#define in(v, s) ((s).find((v)) != (s).end())
#define GCD(x, y) __gcd(abs((x)), abs((y)))

#define INF (LLONG_MAX>>3ll)
#define MOD 1'000'000'007ll

#define mxN 100'010ll

inline void maxa(ll &a, ll b) { if (a<b) a=b; }
inline void mina(ll &a, ll b) { if (a>b) a=b; }

ll n;
int ans[mxN];
int *ar, *bar;

struct pnt { ll i, j; };
inline pnt mpnt (ll i, ll j)
{
	pnt ans;
	ans.i=i, ans.j=j;
	return ans;
}
inline ll s (pnt a) { return ar[a.i] + bar[a.j]; }
inline bool operator< (const pnt &a, const pnt &b) { return s(a) > s(b); }

int *smallest_sums(int N, int *A, int *B)
{
	n=N;
	sort (A, A+n);
	sort (B, B+n);
	ar=A-1, bar=B-1;
	ll cnt=0;

	priority_queue<pnt> pq;
	pq.push(mpnt(1,1));

	while (cnt<n)
	{
		pnt ij = pq.top(); pq.pop();
		ans[cnt++] = s(ij);
		ll i=ij.i, j=ij.j;
		if (i!=n) pq.push(mpnt(i+1, j));
		if (j!=n) pq.push(mpnt(i, j+1));
	}

	return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccFgZjPF.o: in function `main':
grader.cpp:(.text.startup+0x271): undefined reference to `smallest_sums(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status