-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBACS18 - H - RAY RAY ARRAY.cpp
55 lines (52 loc) · 1.01 KB
/
BACS18 - H - RAY RAY ARRAY.cpp
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
55
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz 100010
ll arr[sz];
int t, n, q, x, y;
int p;
int main()
{
cin.sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while(t--)
{
cin >> n >> q;
for(int i=0; i<n; i++)
{
cin >> arr[i];
}
while(q--)
{
cin >> p >> x >> y;
if(p==1)
{
for(int i=0; i<n; i++)
{
if(arr[i] <= x)
{
arr[i] -= y;
}
}
}
else
{
for(int i=0; i<n; i++)
{
if(arr[i] >= x)
{
arr[i] += y;
}
}
}
}
for(int i=0; i<n-1; i++)
{
cout << arr[i] << " ";
}
cout << arr[n-1] << "\n";
}
return 0;
}