#include <bits/stdc++.h>
#include "aplusb.h"
using namespace std;
std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B)
{
set<pair<int, pair<int, int>>> st;
for (int i = 0; i < N; i++)
st.insert({B[i] + A[0], {1, i}});
vector<int> ans;
for (int i = 0; i < N; i++)
{
auto it = st.begin();
st.erase(it);
ans.push_back((*it).first);
if ((*it).second.first != N)
st.insert({(*it).first + B[(*it).second.second] + A[(*it).second.first], {(*it).second.first + 1, (*it).second.second}});
}
sort(ans.begin(), ans.end());
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |