#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define xx first
#define yy second
#define all (x) begin (x), end(x)
vector <int> smallest_sums (int n, vector <int> a, vector <int> b){
sort (a.begin(), a.end());
sort (b.begin(), b.end());
set <pair<int, pair<int, int>>> s;
vector <int> rez;
for (int i = 0; i < n; ++ i){
s.insert ({a[i] + b[i], {i, 0}});
}
for (int i = 0; i < n; ++ i){
auto val = *s.begin();
rez.push_back(val.xx);
s.insert ({a[val.yy.xx] + b[val.yy.yy + 1], {val.yy.xx, val.yy.yy + 1}});
s.erase(val);
}
return rez;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
Incorrect |
1 ms |
348 KB |
1st lines differ - on the 2nd token, expected: '3', found: '4' |
6 |
Halted |
0 ms |
0 KB |
- |