kingofnumbers's blog

By kingofnumbers, 12 years ago, In English

Hi, since the editorial for round #177 is too late, I wish someone would share his idea of solving div1 D and div1 E,

thanks.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

I tried alot to think about an idea to solve this problem but I couldn't find the way to solve it so I need help.

thank you.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Who has got one like this before ?

http://s10.postimage.org/4g2d2kdg9/1234123.png

sorry for big image

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

hi

I have searched the internet alot but didnt find a good article about min cost max flow

given a directed graph each edge has cost for transfering one unit and capacity that spicify maximum number of units can pass the edge find minmum total cost to transfer K units from node S to node T(not neccessery max flow only K units)

can you give me good article to solve this problem

thanks

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

I need help to solved this intersting problem link .

thank you in advance.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

I need help to solve this problem

given a tree with N nodes and K robots you want minimize the total distance needed to visit each node at least once by one robot if all robots started at node i.

robots are allowed to stop at any node and don't move.

for each node i from 1 to N output the answer if all robots started from node i, more details is in the link above.

N<=15,000 K<=30

thanks..

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi,

I got problem and can't solve it:

given an array consist of N integers A1,A2,A3...An

for each element i from 1 to n you should increase all elements j by (1) such that j<i and A[j]>=A[i]

example: the array is:

4 2 1 3

i=1 :

nothing before 1 so thing will happen here

i=2 :

A[i]=2 so we need to increase all element before i and bigger or equal than A[i] by 1

so the array become:

5 2 1 3

i=3 :

A[i]=1

increase all element before i and bigger ort equal than A[i] by 1

the array become:

6 3 1 3

finally when i=4 :

the array become:

7 4 1 3

so print the new array to the output

N=10^5

sorry for my English.

thanks in advance.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi,

problem:

Given an array with N elements you have to execute two different types of querys:

1- add to the array an element with value X (anywhere).

2- answer how many elements which have value bigger than l and smaller than r.

constrains:

number of querys<=100,000

N<=100,000

l<=r<=N

X<=10^9

I think it can be done using self-balancing binary search tree (for example AVL tree),

but is there is a way easier than this data structure?

I need an ONLINE solution

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi,

Given an Array with N elements each element have 3 integers Say Ai,Bi,Ci.

you have to answer Q querys given in each query 3 integers X,Y,Z you have to say how many elements in the array satisfy Ai>=X , Bi>=Y Ci<=Z

N,Q<=10^5

I hope you help me or give me a hint, thanks.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

13 days ago without a rated contest for div1.

I'm very bored, when will the next contest take place?

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi, I wonder how to solve problem D. Little Elephant and Broken Sorting

I had been waiting for its solution in editorial but is was not published.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi, I have no idea how to solve this problem. can anyone help me?

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi, Just take look how I solved 242E — XOR on Segment

here is my code

the time limit for this problem is 4000ms and the running time for my code is 4000ms :) :] :D

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi,

I need help to solve this problem http://www.spoj.pl/problems/OILCOMP/

in this problem we 2D array A[H][W] and we need to select elements of the array without selecting any two neighbor elements and maximize the sum of the elements selected.

the neighbors of element A[ i ][ j ] is A[ i-1 ][ j ] , A[ i+1 ][ j ] , A[ i ][ j-1 ] , A[ i ][ j+1 ].

I heard that this problem can be solved two ways, the first is network flow and the second is dp with bitmasks

I need to know both ways please.

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

I need help with this problem ,because I have no idea how to solve this

problem statement:


You have an array with N elements (1<=N<=1000), you need to sort this array in non-increasing order, you can only move the element in position i to position j: 1- by swaping i and i+1 then swaping i+1 and i+2 ... swaping j-1 and j (if i<j) 2- by swaping i and i-1 then swaping i-1 and i-2 ... swaping j+1 and j (if i>j) in both operations the cost of the operation is i+j find the minimal cost that you can sort the array non-increasing order input: first line contains integer N second line contains N space-separated integers the elements of the array output: one integer the minimal cost Sample test: input: 5 20 30 5 15 10 output: 11 Note: in the sample test moving element in position 3 to 5 will cost (3+5)=8 moving the element in position 2 to 1 will cost (2+1)=3 total cost 3+8=11

Full text and comments »

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

By kingofnumbers, 12 years ago, In English

Hi, If i want to compute (1065*1001) mod 1000 , the best way to do this is computing (1065 modulo 1000) and (1001 modulo 1000) then Multiplying the two numbers so (1065 modulo 1000) = 65 and (1001 modulo 1000) = 1 then 65 * 1 = 65 so: (1065*1001) mod 1000 = 65 this way is much easier than computing 1065*1001 then modulo 1000

so my question is: is there a way resemble to the way above working with division like (6072/1012) mod 5 thanks.

Full text and comments »

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