-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB.cpp
120 lines (105 loc) · 3.33 KB
/
B.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,b,a) for(int i=b;i>a;i--)
#define FORDE(i,b,a) for(ll i=b;i>=a;i--)
#define debug(x) cout<< '>'<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";
#define debug3(x,y,z) cout<< '>'<<#x<<" : "<<x<<"\n"; cout<< '>'<<#y<<" : "<<y<<"\n";cout<< '>'<<#z<<" : "<<z<<"\n";
#define umap unordered_map
#define uset unordered_set
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define in insert
#define s second
#define f first
#define nn cout<<"\n"
#define pb push_back
#define testcase int t;cin>>t;while(t--)
#define gcd(a,b) __gcd(a,b)
#define maxv INT_MAX
#define minv INT_MIN
#define MOD 1000000007
#define SACHITJAGGI ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define here cout<<"I'm here\n";
#define flush cout.flush();
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define setcount(x) __builtin_popcountll(x)
#define ordered_set_single tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
typedef tree<
pair<ll, ll>,
null_type,
less<pair<ll,ll>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set_pair;
inline int add(int a,int b) { return (a%MOD + b%MOD + MOD)%MOD; }
inline int mul(int a,int b) { return (a%MOD * b%MOD + MOD)%MOD; }
inline int sub(int a,int b) { return (a%MOD - b%MOD + MOD)%MOD; }
template<class T> void dispvector(vector<T> v){ for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout << "\n"; }
ll power(ll x, ll y, ll p)
{
ll res = 1; // Initialize result
x = x % p; // Update x if it is more than or
// equal to p
while (y > 0)
{
// If y is odd, multiply x with result
if (y & 1)
res = (res*x) % p;
// y must be even now
y = y>>1; // y = y/2
x = (x*x) % p;
}
return res;
}
ll modInverse(ll n, ll p)
{
return power(n, p-2, p);
}
signed main(int argc, char** argv)
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
SACHITJAGGI
long t=1;
cin>>t;
while(t--)
{
ll n,k;
cin>>n>>k;
vector<ll> arr(n);
FOR(i,0,n) cin>>arr[i];
ll v2=0;
FOR(i,0,n)
{
if(k%2==0 && arr[i]==k/2)
{
cout<<v2<<" ";
v2++;
v2%=2;
}
else if(arr[i]<=k/2)
{
cout<<1<<" ";
}
else
{
cout<<0<<" ";
}
}
cout<<endl;
}
return 0;
}