Hacker-M's blog

By Hacker-M, 3 years ago, In English

Hi, Which one of the following ways is better to store the non-duplicate numbers?

1- Using sort and unique in std :: vector in C++ like this :

sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());

2- Using std :: set in C++

I know set's Order is around $$$O(nlogn)$$$ with a little bad coefficients But I don't know what's the order of using vector and unique, So If it is possible tell me which one is faster and better, Thanks :).

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

By Hacker-M, 3 years ago, In English

In the time of war of Russia there many more attacks on Syria and yeman please also see these countries :( Link to donate : (check if it is correct) https://support.womenforwomen.org/crf-syria?src=GSEV223C&ms=cpc_google_donation&utm_medium=cpc&utm_source=google&utm_campaign=donation&utm_content=gs+ad&gclid=Cj0KCQiAmeKQBhDvARIsAHJ7mF6VYUe5AIy5taSPh9vd0q7KWYnKSHWNH5kCbjTB7-FXUhMBYxe-3lUaAhsHEALw_wcB Or some yemani or Syrian person who has a valid link to pay money for those countries then share here.

Full text and comments »

  • Vote: I like it
  • -22
  • Vote: I do not like it

By Hacker-M, 3 years ago, In English

Hi !

I was googling how to debug faster without writing many cerrs and I found out this blog, then I found out that I don't want to write this much code in my default code on my computer then when I wan in tourist's live stream I saw he is using a local include and I want to use something like that, can anybody pls help, Btw I am using sublime text.

This is the code I want to make include for it

I just want to write this part in my code when I am practicing :

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

Full text and comments »

  • Vote: I like it
  • -12
  • Vote: I do not like it