CodeTON Round 8(Div. 1 + Div.2, Rated, Prizes!)
作者:
zplzh
,
2024-03-31 01:32:52
,
所有人可见
,
阅读 13
#include <bits/stdc++.h>
#define IOS() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
using namespace std;
int a[200000+10], ans[200000+10];
void solve(){
int n;
cin >> n;
for(int i = 1; i <= n; i++)
cin >> a[i];
set<int> ti;
int flas = 0;
for(int i = 1; i <= n; i++){
while(ti.count(flas))
flas++;
ans[i] = a[i] > 0 ? flas : flas - a[i];
ti.insert(ans[i]);
}
for(int i = 1; i <= n; i++)
cout << ans[i] << " ";
cout << "\n";
}
signed main(){
IOS();
int t=1;
cin >> t;
while(t--) solve();
return 0;
}