EGYPT's blog

By EGYPT, 13 years ago, In English
I get TLE on testcase 16 i think my algorithm is true but i need tips to improve the speed of the algorithm

some useful hints if you will help me:

1-I use recursive function but i make global varible called ct which count the steps .
2-I mark visited cell with '#' on the same matrix.
3-I make global variable called dr ,i save the last direction on it.
so   R RRL L and last direction L i will ignore the value of the cells RRL
4-Every iteration i pick cell and make recursive call on it,i make ct=0 and i send matrix by value not by reference.

if my approach totally wrong please tell me the true approach 

Click Here to see my code
Thanks in advanced.



Full text and comments »

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

By EGYPT, 13 years ago, In English

I ask if i can calculate xor  to all numbers in a specific range without using loop

for example if  i have 

start=3  
end =3211233432145321;

the result  start ^ start+1 ^ start+2 ^ start+3.........end-1^end

Thanks in advanced.

Full text and comments »

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

By EGYPT, 13 years ago, In English

Problem A


most competitors use this approach in this problem
check max between wight between low and high
so res=max(wight(low),wight(high).
then putting current =5
then loop while current<=high
get max between res and and wight(current) and wight(current-1)
then current=current*10

I know this algorithm work correctly but what's the proof 

for example if the range 1-783432
so the result max wight between (783432,500000,499999)

Full text and comments »

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

By EGYPT, 13 years ago, In English

Today I will Enter this contest as out of competition ,

I wan't to know if i can hack or not,
and i want to know my distribution "my room contain only out of competition people or not".
Thanks for clarification  

Full text and comments »

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