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

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

I am not able to share the virtual camera of OBS on zoom. How to fix this issue? I tried leaving and re-entering zoom, but that's not working.

UPD : I am using Macbook Air M1,2020

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

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

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

The problem asks to check if it is possible to rotate a square(of side length R*sqrt(2) in the problem) with fixed center(origin on 2-D plane) such that two points p1(x,y) and p2(x,y) lies on the border of square.

I have coded a solution using floating point operations, but it is failing on test #10.

It would be great help if anyone can help with a method using integer operations.

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

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

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

Can someone please help me solve this problem. I came up with the following observations:

1) the first bit of the binary number should be 1.

2) we can think of each binary prefix(modulo n) as a node of the graph. So finally we need to find a hamiltonian cycle starting at 0 and ending at 0 where each node has an outgoing edge to the nodes (2*node)%n and (2*node+1)%n.

I am unable to progress further. Any help/hint will be really helpful.

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

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

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

Brute force solution:

vector<long long> bruteforce_solve
{
	vector<long long> ans;
	for(int j=2;j<=n;j++){
		long long sum=0;
		for(int i=1;i<j;i++)
		{
			//LCA(i,j) returns the least common ancestor of 2 nodes in tree.
			sum+=V[LCA(i,j)];	
			//V[LCA(i,j)] is the value written on node LCA
		}
		ans.push_back(sum);
	}
	return ans;
}

Problem Link

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

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

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

There are two integer points A and B in the 2-D plane. We need to find another point C satisfying the following conditions:

  1. C has to be different from A and B.

  2. There is no integer coordinate point on the line segment AC other than its endpoints.

  3. There is no integer coordinate point on the line segment BC other than its endpoints.

  4. Triangle ABC must have a positive area.

  5. There is no integer coordinate point strictly inside ABC.

Constraints:

1.|Ax| <= 1e9, |Ay| <= 1e9, |Bx| <= 1e9, |By| <= 1e9.

2.Cx and Cy must be within [-1e14, 1e14].

Problem link: problem D

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

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

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

A sequence of integer numbers a0, a1, . . . , an, . . . , is called the Fibonacci sequence modulo r if a0 = 0, a1 = 1, and ai = (ai−2 + ai−1) mod r for all i ≥ 2. A number p > 0 is called the period of the sequence, if there is some i0, such that for all i ≥ i0 the equation ai = ai+p is satisfied. The sequence is called periodic if it has a period. Clearly, if the sequence is periodic, it has the smallest period. Given r you have to find whether the sequence Fr is periodic, and if it is what is its smallest period. Constraints: 2 <= r <= 2*10^9

Link to the problem: Problem E.

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

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

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

Can someone tell how should I learn string-processing algorithms? I currently know only z-function. Where to start learning suffix-array, suffix-tree, suffix-automaton and also in what order. Also is there a good collection of question related to this topic.

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

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

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

Problem. I checked various solutions. I could see DSU and Dynamic programming in most of them. Any hint or full solution would be helpful.

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

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