650iq's blog

By 650iq, history, 2 months ago, In English

https://mirror.codeforces.com/contest/1155/problem/D

This problem is similar to yesterdays atcoder regular contest problem A, where i used the logic that if X>0 we multiply the maximum segment and if X<0 we multiply the minimum segment but if i use the same logic in this question it is giving WA on test 10. Can someone pls help me understand why it doesn't work here?

Full text and comments »

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

By 650iq, history, 2 months ago, In English

You are given an integer x which is initially 1. In one move You can perform either of the 2 operations — make x = x-1 or x=2*x. You need to perform exactly K such operations. Find if it is possible to make number N from X. Note N and K is very high upto 10^18.

Full text and comments »

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

By 650iq, history, 5 months ago, In English

The professor is planning a heist, this time in England. He along with his team of robbers want to break into the Jewel House at the Tower of London to steal the Kohinoor.

He has done his research and found that the lock of the Jewel House is password encrypted. The password is of length len and it is in lowercase ['a'-'z']. From his research, the professor got to know that password have, p number of pairs (L, R) which signifies the starting and ending position of the substring and every such substring must be a palindrome.

Given the values, calculate how many times the robbers have to input the password to try all possible passwords.

As the answer can be large, print it modulus 1000000007 (1e9+7).

Example:

Input

len = 4

p=3

pairs are [[1.2]

12,3],

[3.4]

Output

26

Full text and comments »

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

By 650iq, history, 5 months ago, In English

Hi everyone. Whenever i learn a new algorithm/technique it stays with me for about an week, after that if i dont solve problems on that technique or algorithm i usually forget about it in future and have to relearn it again. How can i not forget it and retain it forever. Pls help if someone knows how to tackle this

Full text and comments »

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

By 650iq, history, 5 months ago, In English

https://mirror.codeforces.com/contest/1670/problem/B

Can someone pls tell me why im getting TLE in this.. although its just O(n). Here is my submission 238974486

Full text and comments »

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

By 650iq, 6 months ago, In English

Given an undirected graph with N nodes and M edges. The score of the graph is the number of good edge which we can collect. A good edge is a edge which is not a part of a cycle. Now John wants to add exactly one edge to this graph in such a way that the number of good edges is as minimum as possible.

Example -

5 4 ->n,m (1 2), (1 3), (1 4), (1 5)

Initially, there are a total of '4' good edges . One of the best ways to reduce the number is by adding edge between '2' and '5'. Now, there are only '2' good edges (1 → 3 and 1 → 4) which can be used. So, the answer is '2'.

Full text and comments »

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

By 650iq, history, 6 months ago, In English

Hi everyone i was trying this question from Atcoder — https://atcoder.jp/contests/abc157/tasks/abc157_e But im getting runtime error on my code. My approach is to build a segment tree where each node contains a map of characters. And while we go up we keep on merging the maps into a single map and the return the size of the map as a answer to the query. Im not getting any WA but RE. Please help. Here is my submission https://atcoder.jp/contests/abc157/submissions/47573702

Full text and comments »

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

By 650iq, history, 6 months ago, In English

There are N towers arranged in a single line. You want to rearrange all the towers.

Given an array H of size N, where Hi denotes the height of tower i. You can rearrange this array in whatever way you like.

Beauty is defined as follows:

If j is the position of the tower i in the final arrangement, you add Hi*abs(i-j) to the Beauty.

Your task is to find the maximum Beauty you can achieve, after rearranging the towers.

I could only come with bitmask dp solution but here N is 10^3 so it won't work.

Full text and comments »

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

By 650iq, history, 7 months ago, In English

Hi, i stumbled upon a cf profile and saw this. I went to the submissions of the contest and all solutions were skipped for the user but still rating change is positive for the user and not removed it and it is not a recent contest but 2 months back. ![ ](IMG-20231024-090138)

Full text and comments »

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