We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3255c07 commit 9c5cf3aCopy full SHA for 9c5cf3a
1811C-RestoreTheArray.cpp
@@ -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