0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 13:16:26 +00:00

T202691 「MCOI-08」【A】Fill In

R73663844
This commit is contained in:
Baoshuo Ren 2022-04-10 16:13:33 +08:00
parent 7804ec198c
commit 4e67b54a86
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

40
Luogu/T202691/T202691.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <cstdio>
const int N = 1e5 + 5;
int t, n, a[N], p[N];
int main() {
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", p + i);
}
for (int i = 1; i <= n; i++) {
if (p[i] == -1) {
p[i] = p[i - 1] + 1;
}
}
for (int i = 1; i <= n; i++) {
a[i] = p[i] - p[i - 1];
}
for (int i = n; i; i--) {
if (a[i] > 1000) {
a[i - 1] += a[i] - 1000;
a[i] = 1000;
}
}
for (int i = 1; i <= n; i++) {
printf("%d ", a[i]);
}
printf("\n");
}
return 0;
}