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

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

Hi dear community!

last day I was solving a GCD problems, it was easy for a,b <= 10^5 but when the limits change to a,b <=10^9, I got TLE how can I optimize this? what that it mean GDC(a,b)=GCD(b,a%b)? and how can I apply this to solve the problem?.

thanks in advanced

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

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

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

Hello Codeforces.

Last week i just trying to solve this problem bubblesort2 so i just was able to solve until the first 2 subtasks, these is my solutions for the first 2 subtask.

SUBTASK 1 and 2:

I create an array of pases, for each i (0<=i <n), I store Pases[i]=Solve(i)

Solve(i) --> , in it, I will store the amount of prior numbers greater than A[i].

and the maximun passes is gonna be the answer.

and finally for the update I just do the same but here in O(n), how?

let's : Pos= X[i], Nuevo=V[i], Antiguo=A[Pos];

I update A[pos]=Nuevo;

after that i change the value of Pases[i], just calling the funtion Solve(i), I mean:

Pases[Pos]=Solve(Pos);

and in order to update all the numbers after Pos (Pos+1 <= j < n), I just use this condition:

if(Antiguo >= b and Nuevo < b) Pases[j]--; if(Antiguo <= b and Nuevo > b) Pases[j]++;

i finally y just find the maximun value.

Here is my Code

this solution gives me 38 points, but now i can't continue anymore, because i don't know how to solve the 3rd subtask and the last one. please help me I am with this problem the last week.

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

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

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

Hello everyone.

recently i was solving a problems very interesting.

https://jv.umsa.bo/problem.php?cid=1526&pid=19

It is a virtual judge from UMSA (Universidad Mayor de San Andres), the problem say that you have to simulate a calculator, i solve it and got AC:

https://ideone.com/AknWo6 <---- Here is my code

but I see a very diferent solution of my friend he first move the diferent operators to the beginning and later process it.

could someone explain me this please.

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

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

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

Hello everyone, I invite you to visit my blog:

https://lushoplusplus.blogspot.com/

Please don't forget to leave your comments on the comment box

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

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