Skip to content

Commit 9c5cf3a

Browse files
committed
Create 1811C-RestoreTheArray.cpp
1 parent 3255c07 commit 9c5cf3a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

1811C-RestoreTheArray.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <cstdio>
2+
#include <vector>
3+
4+
int main(){
5+
6+
long t; scanf("%ld", &t);
7+
while(t--){
8+
long n; scanf("%ld", &n);
9+
std::vector<long> b(n - 1); for(long p = 0; p < n - 1; p++){scanf("%ld", &b[p]);}
10+
printf("%ld ", b[0]);
11+
for(long p = 1; p < n - 1; p++){printf("%ld ", b[p - 1] < b[p] ? b[p - 1] : b[p]);}
12+
printf("%ld\n", b.back());
13+
}
14+
15+
}

0 commit comments

Comments
 (0)