Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

LushoPlusPlus's blog

By LushoPlusPlus, history, 5 weeks ago, In English,

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

Read more »

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

By LushoPlusPlus, history, 23 months ago, In English,

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.

Read more »

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

By LushoPlusPlus, history, 2 years ago, In English,

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.

Read more »

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

By LushoPlusPlus, history, 2 years ago, In English,

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

Read more »

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