hexor's blog

By hexor, 9 years ago, In English

Can someone send me some document or code for "Suffix Array O(N) implementation" ?

Full text and comments »

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

By hexor, 9 years ago, In English

Can someone give me some hard treap problem?

Full text and comments »

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

By hexor, 9 years ago, In English

I push OK("Tamam"). But I don't believe Santa Claus. What can I do??? Help me!!

Full text and comments »

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

By hexor, 9 years ago, In English

Turkish Olympiad in Informatics start in one hour. T.O.I's some contestants are in this link.

Full text and comments »

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

By hexor, 9 years ago, In English

What is the difference between g++ and c++ command in ubuntu terminal?

Full text and comments »

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

By hexor, 9 years ago, In English

N trees were planted on a side of a long straight road. In the other side there are farms, industries etc. The market price of these trees is huge now. Some greedy people want to cut these trees down and want to be millionaires. They got the permission from the Govt. decoying that they would develop the area. You published this fact in the web and millions raised their voices against this conspiracy.

You gathered the information of the trees and found the type and height of all trees. For simplicity, you represented them as integers. You want to find the overall price of the trees. To find the price, the following method is used.

1) The trees are first partitioned into groups with the condition that, types of two trees will not be similar in a group. A group can only be formed using contiguous trees.

2) The price of a group is equal to the height of the tallest tree.

3) The overall price is the summation of prices of all groups.

Now you want to find the minimum possible price of the trees in this scheme and show the Govt. that even though you calculated the minimum possible price, it's actually huge.

Can anyone help me?

N(1≤N≤2 * 105)

links: Lightoj 1415 and UVa 12440

Full text and comments »

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

By hexor, 10 years ago, In English

I found a new theorem and I called it "My Remainder Theorem". My theorem finds similar thing with "Chinese Remainder Theorem". Maybe it has been founded before. If you heard this theorem before, please tell me.

Problem :

We have N equation.

x = equation_1.a ( mod equation_1.b )
x = equation_2.a ( mod equation_2.b )
.
.
.
x = equation_n.a ( mod equation_n.b )

(1<=i<=n) equation_i.b can be not a prime number. ( difference between my M.R.T. and C.R.T. )

We use a function which can do merge two equation and create a new equation. ( Let's call this function "merge" )

For example we have 3 equations. We'll solve this problem.

ans1 = merge( equation_1,equation_2 ); ans2 = merge( a,equation_3 );

Our answer is ans2.a.

Let's look at to "merge" function.

  • We assume equation_1.b > equation_2.b
  • lcm -> least common multiplier
merge( equation_1,equation_2 ){
	LCM = lcm(equation_1.b,equation_2.b)
	KKK = LCM/equation_1.b
	for i=0 to KKK-1
		if( ( i*equation_1.b + equation_1.a ) mod equation_2.b == equation_2.a )
			return answer = make_equation( LCM , i*equation_1.b+equation_1.a )	//	x = i*equation_1.b+equation_1.a(mod LCM)
	return "NO SOLUTION"
}
  • If there is any solution for equation_1 and equation_2, also there is a solution for i<=KKK-1.
  • We try all possible i values and we get a x value for equation_1. Then we check if x equals to equation_2.b+equation_2.a .
  • If this condition is true, we find a x value. // x = i*equation_1.b+equation_1.a(mod LCM)
  • If there is no x value, that means solution doesn't exist.

This algorithm's complexity is O( max( equation_i.b )*n )

Full text and comments »

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

By hexor, 10 years ago, In English

I want the ask aquestion. "You have a DAG(directed acyclic graph) which is the contain n(1<=n<=300.000) nod. How many nodes can you go if you will start nod i(1<=i<=n). You must find answer for all nod."

Full text and comments »

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

By hexor, 10 years ago, In English

Where can I find English solution for Polish Olympiad in Informatics?

Full text and comments »

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

By hexor, 10 years ago, In English

What can I calculate N! for N<=10^9?

Full text and comments »

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

By hexor, 10 years ago, In English

if we know log(a) and log(b) how we can find log(a+b) approximately to real value?

Full text and comments »

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

By hexor, 10 years ago, In English

Is there any website which we can submit all or most of IOI problems?

Full text and comments »

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

By hexor, 11 years ago, In English

What is the Max Flows algorithm which name is Ford Fulkerson time complexity on bipartite graph?

Full text and comments »

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

By hexor, 11 years ago, In English

Can you give me a some trick for xor( exclusive or ) operation?

Full text and comments »

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