답안 #840485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840485 2023-08-31T12:21:02 Z ZeroCool A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB
#include "aplusb.h"
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long

vector<int> smallest_sums(int n, vector<int> A, vector<int> B) {
	set<int >s;
	priority_queue<tuple<int,int,int> , vector<tuple<int,int,int> > , greater<tuple<int,int,int> > > pq;


	pq.push({A[0] + B[0], 0, 0});
	set<pair<int,int> > st;
	vector<int> ans;
	for(int i = 0;i<n;i++){
		int val = get<0>(pq.top());
		int posa = get<1>(pq.top());
		int posb = get<1>(pq.top());
		pq.pop();

		ans.push_back(val);

		if(posa + 1 < n && !st.count({posa + 1, posb})){
			pq.push({A[posa + 1] + B[posb],posa+1, posb});
			st.insert({posa+1, posb});
		}

		if(posb + 1 < n && !st.count({posa, posb+1})){
			pq.push({A[posa] + B[posb+1],posa, posb+1});
			st.insert({posa, posb+1});
		}
	}
	
	return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccvtZYtj.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