Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя I_LOVE_ROMANIA

Автор I_LOVE_ROMANIA, история, 2 года назад, По-английски

Hey! Is someone who can help me solve this faster than O(N^2)? The problem: initially we have an array V1 of size N with the numbers from 1 to N ordered.

Example: N = 4; V1 = {1, 2, 3, 4}.

We have a second array of N numbers, let's say V2 = {3, 2, 0, 1}. For each position 'i' from right to left, we will apply the operation "move right the element V1[i] with V2[i] positions.

We have 4 operations {3, 2, 0, 1}. Apply i = 3, so V1 will be {1, 2, 3, 4}; further we apply i = 2 (V2[2] = 0 so V1[2] stays); we apply i = 1, so we move the element '2' with 2 positions right in V1 (the array becomes {1, 3, 4, 2}. Finally we apply i = 0 so V1 becomes {3, 4, 2, 1}.

Any idea? Thank you!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

Автор I_LOVE_ROMANIA, история, 5 лет назад, По-английски

Hey guys! My professor proposed me to solve this problme. Given a number p <= 10^7, print the sum of the digits of 2^p. For exemple, 2^4 = 16 so we'll print 7. How can I do this properly? I first tried to use in a way or in another, the little theorem of fermat but it made no sense here.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +26
  • Проголосовать: не нравится

Автор I_LOVE_ROMANIA, история, 5 лет назад, По-английски

Hey! Can anybody help me with a solution to this? We have an array of pairs [ (x1,y1) , (x2,y2), ... , (xn,yn) ]. Initially, we are at the coordinates (0,0). We can use whatever pair from the array (maximum one time) to move from the actual position (a,b) where we are to (x + xi, y + yi). The numbers from the array's pair are between [-10^4, +10^4]. Which is the maximum distance we can move from the origin (0,0) after using some of these pairs from the array? We have a maximum of 2000 pairs. I am grateful to those who brighten me.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +40
  • Проголосовать: не нравится

Автор I_LOVE_ROMANIA, история, 5 лет назад, По-английски

Hey guys! Can anybody explain to me how to find the bridges in a graph? I know how to find the articulation points, but I don't know how to handle the bridges. Also, is there any platform where I can submit these 2 classical algorithms? Thank you in advance!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор I_LOVE_ROMANIA, история, 5 лет назад, По-английски

Hi! I encounter difficulties in finding a solution to this problem: having a matrix filled with 0 and 1, size N x N with N <= 1000, output the number of squares with the border filled with 1 (we are not interested in what's inside the square). We consider valid even the squares of size 1x1. For this example, the answer is 27. Can anybody help me? (sorry for the example, I don't know how to show the lines one above the others) 0000000 0111100 0101111 0100101 0111111 0000011 0000011

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится