l ka role se mera matlab tha ki hum kahi bhi
ans= L * something aise kuch nahi kar rahe hain
answer is all dependent upon ur set content and a[i]
bus mein ita bol raha tha
l ka role se mera matlab tha ki hum kahi bhi
ans= L * something aise kuch nahi kar rahe hain
answer is all dependent upon ur set content and a[i]
bus mein ita bol raha tha
Bhaiya, yah bataye ki different set of elements ke lea same XOR value ho nhi sakta for the same given array of elements…
ho sakta hai bilkul ho sakta hai.
aur ye hum ways count karte time count bhi kar rahe hain
Accha…iska mtlb jab hum condition check kr rhe hai ki a[i] set peh hai ya nhi,
Agar hai toh hum ans=2*ans kr rhe hai, aur yhi counts bata rha hai…
ha . . . . . . . .
cf ka editorial dekho unho ne is point ko kaafi ache se clear kiya hai
read from here->
Bhaiya, tab mera question ka matlb tha ki,
different length of the set of elements ke lea same XOR value ho sakta hai kya from the given array of elements?
ha .
example->
[1,1,2,2] -> isme [1,1] bhi 0 hai [2,2] bhi 0 hai aur
[1,1,2,2] bhi 0 hai .
yahi doubt tha na tumhara mein bhi yahi bata rAHA THA
if a[i] is not there, toh fir 3 cases hai. Aur 2 case ke lea, number of ways same hi rahega so set ko bas update krna hai…
Aur, jab a[i] set meh nhi ho tab update kr rhe hai ese…
a. Ek vector liya aur current element a[i] ko each and every element present in the set ke sath xor kr rhe hai aur vector meh push kr rhe hai.
b. fir vector se set meh sare element ko insert kr rhe hai.
ha aisa bhi kar sakte ho
but jo code unhone mention kiya hai usme thoda alag kar rahe hai(thoda sa different hai)
Kaha peh…? Cf meh
ha cf pe
wo vector ko as set istemal kar rahe hai.
aur usi vector ke end me push kar rahe hai ( tumhare approach bhi sahi hai).
yaha pe s jo hai vector hai jo as set behave kar raha hai.
aur b jo hai wo ye bata raha hai ki xor present hai ya nahi
Bhaiya, yah bhi ho sakta hai ki, same length of sets of values ke lea different XOR value?
ye to kaafi obvious hai.
[ 1 , 2] array hai to [1] , [2] same length different xor
Nai meh input ko lene ka structure se bol rha tha, kyun ki input ko lia gaya hai like,
v[l-1].push_back({x,i});
So, mujhe laga yhi reason hoga ese likhne ka…
nahi aisa kuch nahi hain
waise bhi v to vector hai usme duplicate store kar sakte
toh fir ese input lene ka mtlb kya hai?
kuch nahi tum {i,x} le lo
bhaiya, ise ese lene ka karan mujhe jo abhi tak laga woh yah hai ki, 2 reason hai…
agar (L,X) => (3,5) ka value nikal na hai so possibility yah bhi ho sakta hai ki first 2 elements ke lea bhi 5 aa gaya, so inn dono ko differentiate karne ke lea humne ese likha hai so (v[3-1].second==x) hai tab ans ka value result[v[2].first] meh store kr dena hai…
esa bhi toh ho sakta hai ki input meh de diya, (L,X) ka value (3,5) aur (3,7) so yah do pair ek hi vector meh push hoga, v[2] meh…
Jaise, [1,1,2,2] meh, (2,0) ke lea 2 hai aur (4,0) ke lea 1 hai