Help needed in XORSUB

@l_returns has an awesome and easy to understand solution.
But if you are looking for a recursive solution then you can have a look at this solution.

3 Likes

@shivamchef
unordered set means it completely unordered… adding one element can change order of all other elements…
So if you insert elements while you are using for each loop then there will be lot of mess…
https://www.codechef.com/viewsolution/24082696
here is your AC solution
check this code and you’ll understand the problem…

Code
#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007

int main() {
   FIO;
   int t,n,k,i,j;
   unordered_set<int> v;

   v.insert(0);
   v.insert(5);
   v.insert(8);

   for(auto it:v)
      cout << it << " ";
   cout << endl;

   v.insert(4);

   for(auto it:v)
      cout << it << " ";
   cout << endl;

   v.insert(10);

   for(auto it:v)
      cout << it << " ";
   cout << endl;

   return 0;
}
1 Like

Karma Farming :stuck_out_tongue:

2 Likes

yeah inspired by @vijju123 XD…

1 Like

I think there are 3 levels and vijju is on 3rd one… I am on 2nd one… XD
Now i think i wont get to 3rd level…

2 Likes

exactly… got it XD… never mind…
that’s very bad @taran_1407@vijju123 may ban both of them… be careful XD…

1 Like

Off-topic level --> infinity :rofl: :joy:

2 Likes

You just pitched an idea for @vijju123 .
@taran_1407 beware!

thanks for the solution :smiley:

:joy::joy::joy:… (Need 20 characters)

1 Like

Lol,I never knew that top-contributors get laddus :stuck_out_tongue: :stuck_out_tongue:

1 Like

They used to get laddus… Now people don’t get it…

How can I know my trust level? I cannot see it anywhere :frowning:

You are member… 2nd level…

1 Like

Really a important lesson on unordered Set . it’s looking like you saved me from 10s of future WA.

2 Likes

Now, I have 3rd-level of trust :sunglasses:

I’ve gained super-saiyyan abilities on Codechef-discuss :slight_smile:

Haha really ? Is that the third level ? How to achieve that ?

1 Like

You need magical super powers … if you don’t have them, then you need to convince the ‘Chef’ that you deserve those magical powers…and he’ll give it to you :heart_eyes::heart_eyes::heart_eyes::heart_eyes::heart_eyes:

Maybe I should try convincing pseudo admin @vijju123 ( credits to @aryanc403 for calling him that) for giving me trust level three… :joy:

1 Like

How to gain it be a secret then.

1 Like