답안 #840421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840421 2023-08-31T11:20:32 Z grossly_overconfident A Plus B (IOI23_aplusb) C++17
10 / 100
1 ms 300 KB
#include <bits/stdc++.h>
#include "aplusb.h"
using namespace std;

vector<int> smallest_sums(int n, vector<int> a, vector<int> b) {
	priority_queue<pair<int, pair<int, int>>> pq;
	vector<int> out(n);
	set<pair<int, int>> visited;
	int f = 0;
	pq.push({a[0] + b[0], {0, 0}});
	for (int i = 0; i < n; ++i){
		auto h = pq.top();
		pq.pop();
		out[f] = h.first;
		f += 1;
		if (!visited.count({h.second.first + 1, h.second.second})){
			pq.push({a[h.second.first + 1] + b[h.second.second], {h.second.first + 1, h.second.second}});
			visited.insert({h.second.first + 1, h.second.second});
		}
		if (!visited.count({h.second.first, h.second.second + 1})){
			pq.push({a[h.second.first] + b[h.second.second + 1], {h.second.first, h.second.second + 1}});
			visited.insert({h.second.first, h.second.second + 1});
		}
	}
	return out;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Incorrect 1 ms 212 KB 1st lines differ - on the 2nd token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Incorrect 1 ms 212 KB 1st lines differ - on the 2nd token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Incorrect 1 ms 212 KB 1st lines differ - on the 2nd token, expected: '3', found: '4'
6 Halted 0 ms 0 KB -