-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Increasing_Sequence.cpp
More file actions
54 lines (53 loc) · 1.13 KB
/
Copy pathA_Increasing_Sequence.cpp
File metadata and controls
54 lines (53 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define fr(i, a, b) for (int i = a; i < b; i++)
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin>>n;
vector<long long> v(n);
fr(i,0,n){
cin>>v[i];
}
vector<int> ans;
for(int i=0;i<n;i++){
if(i==0 && v[i]==1){
v[i]++;
ans.pb(v[i]);
}
else if(i==0 && v[i]>1){
v[i]--;
ans.pb(v[i]);
}
else{
if(v[i-1]-v[i]>1){
v[i-1]++;
ans.pb(v[i-1]);
}else if(v[i]-v[i-1]>1){
v[i-1]++;
ans.pb(v[i-1]);
}
else{
v[i]++;
ans.pb(v[i]);
}
}
}
fr(i,0,n){
cout<<ans[i]<<" ";
}
cout<<endl;
}
return 0;
}