답안 #991257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991257 2024-06-01T16:29:00 Z VMaksimoski008 A Plus B (IOI23_aplusb) C++17
10 / 100
0 ms 348 KB
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
using Node = array<int, 3>;

vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
	vector<int> ans;
	priority_queue<Node, vector<Node>, greater<Node> > pq;
	pq.push({ A[0] + B[0], 0, 0 });

	for(int it=0; it<N; it++) {
		auto [val, i, j] = pq.top(); pq.pop();
		ans.push_back(val);
		if(i + 1 < N) pq.push({ A[i+1] + B[j], i+1, j });
		if(j + 1 < N) pq.push({ A[i] + B[j+1], i, j+1 });
		if(i + 1 < N && j + 1 < N) pq.push({ A[i+1] + B[j+1], i+1, j+1 });
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '31'
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '31'
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 6th token, expected: '32', found: '31'
8 Halted 0 ms 0 KB -