# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
881703 | spdling | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
int A[100005];
int B[100005];
int main() {
int n;
cin >> n;
for (int i = 0 ;i < n; ++i) {
cin >> A[i];
}
for (int i = 0 ;i < n; ++i) {
cin >> B[i];
}
vector<int> ans;
int i = 0, j = 0;
while (ans.size() < n) {
ans.push_back(A[i] + B[j]);
if (A[i] + B[j+1] < A[i+1] + B[j]) {
++j;
} else {
++i;
}
}
for (int c : ans) {
cout << c << " ";
}
cout << "\n";
return 0;
}