_Halabi's blog

By _Halabi, history, 5 weeks ago, In English

hi there <3 share your style of training i mean when you go on more virtual contests , solve hard problems , time you give to problem , what you do when you want to break new rate I hope this blog are useful for me and others

Full text and comments »

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

By _Halabi, history, 7 weeks ago, In English

hey there ! i don’t know many people in the field of cp. I would like to participate in the IEEE competition this year and am looking for someone from Egypt who is interested in joining me.

Full text and comments »

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

By _Halabi, history, 2 months ago, In English

no scheduled div2 rounds !

Full text and comments »

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

By _Halabi, history, 5 months ago, In English

i tried to solve this problem but i have WA 19 , many trials without result so i hope some one can help me <3

my solutin idea :

for each u  we preprocess it that we store for it the 1<<k elemnt after  u in valid sequence    dp[u][k]  and sum untill this elemnt   sum[u][k]  >>  so we can ans queryies about u in log time

submission : 268374991

Full text and comments »

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

By _Halabi, history, 7 months ago, In English

few contests nowadays !

Full text and comments »

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

By _Halabi, history, 7 months ago, In English

i don't know if this work for all contests ! but if u want to see the wrong case in your code in GYM (if the test cases are hidden) clone the contest and u can see the test cases for your submission .

Full text and comments »

  • Vote: I like it
  • +15
  • Vote: I do not like it

By _Halabi, history, 8 months ago, In English

https://mirror.codeforces.com/edu/course/2/lesson/5/4/practice/contest/280801/problem/F

this the lst problem at edu >>segment tree >>part2 the submissions are closed so i need hint !

UPD :
finaly I got AC !

i'm not good enough to write educational blogs  but i write this part as i didn't a lot of sources that explain dynamic segtree .


    this problem need a dynamic segtree  . the idea is that when you have large array (1...1e9)

it's difficult to make the normal segment tree because this need large space but in the same time time complexity is ok and the number of nodes that i visit over all queries are q*(log N) so why we need all this space ?

we can just start from the root nd and iterate on we just need and remark nodes by map such that u will give each node u visit unique id (if it doesn't have one ) and by this id u can for this nd all the information you need but this still take a lot of time and space !

so we will do the same but making each nd holds :

1. ( it's information  , lft  child pointer , rght  pointer , lx , rx )  
   2. function extend that create the two child (lft , rght )

so we can start our basic operation from the root ( it's informaion , lft ,rght , 0,sz) and each nd we visit we extend two childs from and update thier information

code : struct node{ // description bool op = 0 ; int oper =0 ; item val ;

//intialize nd
    node (){
            oper = 0;
            val =  {0,0} ;
    }

    node *  lft  =NULL  , *rght=NULL  ;   //create my two childs
    void extend()         
     {

               int md  = (lx+rx)/2;
               if (lft==NULL){
                       lft  =  new node;
                       lft ->lx =lx;
                       lft->rx =md;
               }

               if (rght==NULL){
                    rght = new node;
                    rght->lx= md;
                    rght->rx = rx;

               }
    }

}

my submission for the problem (it needs more optimiztion ) : https://www.ideone.com/mhb2PB

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By _Halabi, history, 9 months ago, In English

hey there ! /* . if u have a mentor or your rate > 1400 this blog isn't for u <3 . this roadmap is mine and isn't the best but i think it will be useful for u (better than nothing XD) .I'm not english native so my english isn't very good and the sources of topics i'll mention is arabic so i hope people mention english sources for this topics and sheets to practise on it ._anything you don't know search on youtube 'll find alot of videos

*/
in our start at training we need to balance between  : 
 1.solving general problems  (u don't topics needed to solve it 
 2. learning new topic and practise on it untill you be able to solve it's problems
 3. contests (div  4, 3, 2, 1   ...etc) 


so our roadmap : 
1.   C+ basics  ( conditions ,  loops , arrays ,functions )  and practise on it .

2.   from this ladder  enter handle  >> div2 >>A and you will get 100 problem  , solve the first 50 from them 
       link :  /*https://a2oj.netlify.app/ladders*/

3 . learn STLS (  u don't need to learn how they work just learn thier basic functions ).

4. solve from the same ladder >>div2>>a the rest 50 problem  

5.  learn binary search , two pointers , static range queries  

6 . from the same ladder div2>>B solve the first 50

7. now i guess u have the ability to solve A div2 and maybe B so it's time to know that problem on codeforces 
   are divided according to difficulty (800 .. 3500 ) so we will start from 1000 and for each difficulty we will solve 
   untill we able to solve it's problems (no matter time  cause higher problems will make it easy  ) and i think that 30 
   problems of each difficulty is enough  and then from one to higher.
  1. from problemset >> choose difficulty >> solve from 1000 as explained above untill 1200 and then learn recursion

  2. solve untill 1400 and then learn graph (BFS, DFS ,Dijkstra )

10 . solve untill 1600 and then learn DP , then 1700 ,1800

  1. solve 15 problem 1900 and learn DSU

12 .another 15 problem and then learn segment tree from EDU part at codeforces

  1. solve 10 problems from (2000) , learn hashing
  1. if you intend to pariticipate at icpc so every week you enter a contest from GYM that similar to icpc style

15.waiting .....

general notes :
             _never see tags of problem   and you can hide tags from the settings
            _ after step 1 u will always enter contests and some times when you stop entering contests for some time  you 
               maybe need to enter virtual contests
            _always try to up solve after contests 
            _ there's topics like number theory and bitmasking these topics won't take time from you and you will learn it 
              from problem or from searching
            _ read others codes 
            _hv fun XD

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By _Halabi, history, 9 months ago, In English

link : https://csacademy.com/app/graph_editor/

if u are in a contest and u need to save time you can copy the edges (u , v , w) and this site will draw graph for u

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

By _Halabi, history, 10 months ago, In English

i need fast lCA fuction for a tree ( normal problems constraints) to add it to my library untill i learn topics like (sparse table , ..etc)

Full text and comments »

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

By _Halabi, history, 11 months ago, In English

if i need to divide the array into two subsets with the minimum diference between the sum of the two sets what i can do i know the dp(idx,sum) solution but i need faster one

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By _Halabi, history, 14 months ago, In English

in this problem : / *https://mirror.codeforces.com/contest/1614/problem/C */

can any body explain why ((in the editorial he multiplied x at 2 to power n-1 to get the sum of (The Xoring of each subsequence). I understand until this part ("Thus, the i -th bit is included in exactly 2|A|⋅2|B|−1=2n−1 subsequences, which was required to be proved.")

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By _Halabi, history, 16 months ago, In English

nowadays some channels at Youtube solve contest while the contest running the idea that the problems they solve aren't the most difficult problems like A,B Div2 and solving these problem i think will affect a newbie like me who try to be pupil i hope that this problem take some focus from us and codeforces admisions

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it

By _Halabi, history, 18 months ago, In English

207259291

/* the idea is to take the k smallest elements in vector and by prefix array check all the choices to find the mi answer */

Full text and comments »

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