-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOmkar and Infinity Clock.cpp
54 lines (47 loc) · 1007 Bytes
/
Omkar and Infinity Clock.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
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int t; cin>>t;
while(t--)
{
ll a, b; cin>>a>>b;
vector<ll> v, v1, v2;
for(int i=0; i<a; i++)
{
ll x; cin>>x;
v.push_back(x);
}
ll max = *max_element(v.begin(), v.end());
for(int i=0; i<a; i++)
{
v[i] = max-v[i];
}
v1 = v;
max = *max_element(v.begin(), v.end());
for(int i=0; i<a; i++)
{
v[i] = max-v[i];
}
v2 = v;
if(b%2==0)
{
for(int i=0; i<v2.size(); i++)
{
cout<<v2[i]<<" ";
}
cout<<endl;
}
else
{
for(int i=0; i<v1.size(); i++)
{
cout<<v1[i]<<" ";
}
cout<<endl;
}
}
}