#include <bits/stdc++.h>
using namespace std;
int main() {
// freopen("d.out", "w", stdout);
// freopen("d.err", "w", stderr);
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<int> a(n + 2), d(n + 2);
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) cin >> d[i];
vector<int> L(n + 2), R(n + 2);
for (int i = 1; i <= n; i++)
L[i] = i - 1, R[i] = i + 1;
R[0] = 1, L[n + 1] = n;
L[0] = -1, R[n + 1] = -1;
set<int> die, rebuild;
auto process = [&](int x) {
if (L[x] == -1 || R[x] == -1) return;
int recieve = a[L[x]] + a[R[x]];
if (recieve > d[x]) die.insert(x);
};
auto remove = [&](int x) {
L[R[x]] = L[x];
R[L[x]] = R[x];
rebuild.insert(L[x]);
rebuild.insert(R[x]);
L[x] = R[x] = -1;
};
for (int i = 1; i <= n; i++)
process(i);
for (int i = 1; i <= n; i++) {
cout << die.size() << " ";
for (int x : die)
remove(x);
// ! debug start
// cerr << "L : ";
// for (int j = 1; j <= n; j++)
// cerr << L[j] << " ";
// cerr << endl;
// cerr << "R : ";
// for (int j = 1; j <= n; j++)
// cerr << R[j] << " ";
// cerr << endl;
// cerr << "rebuild : ";
// for (int j : rebuild)
// cerr << j << " ";
// cerr << endl;
// ! debug done
die.clear();
for (int x : rebuild)
process(x);
rebuild.clear();
}
cout << endl;
}
return 0;
}
550B - Preparing Olympiad | 939B - Hamster Farm |
732A - Buy a Shovel | 1220C - Substring Game in the Lesson |
452A - Eevee | 1647B - Madoka and the Elegant Gift |
1408A - Circle Coloring | 766B - Mahmoud and a Triangle |
1618C - Paint the Array | 469A - I Wanna Be the Guy |
1294A - Collecting Coins | 1227A - Math Problem |
349A - Cinema Line | 47A - Triangular numbers |
1516B - AGAGA XOOORRR | 1515A - Phoenix and Gold |
1515B - Phoenix and Puzzle | 155A - I_love_username |
49A - Sleuth | 1541A - Pretty Permutations |
1632C - Strange Test | 673A - Bear and Game |
276A - Lunch Rush | 1205A - Almost Equal |
1020B - Badge | 1353A - Most Unstable Array |
770A - New Password | 1646B - Quality vs Quantity |
80A - Panoramix's Prediction | 1354B - Ternary String |