meiniak's blog

By meiniak, history, 7 months ago, In English,

Given an array of strings, each of the same length and a target string construct the target string using characters from the strings in the given array such that the indices of the characters in the order in which they are used form a strictly increasing sequence. Here the index of a character is the position at which it appears in the string. Note that it is acceptable to use multiple characters from the same string. Determine the number of ways to construct the target string. One construction is different from another if either the sequences of indices they use are different, or the sequences are the same but there exists a character at some index such that it is chosen from a different string in these constructions. Since the answer can be very large, return the value modulo (109 + 7). Consider an example with n = 3 strings, each of length 3. Let the array of strings be words = ["adc", "aec", "erg"], and the target string target = "ac". There are 4 ways to reach the target.

  1. Select the 1st character of "adc" and the 3rd character of "adc".
  2. Select the 1st character of "adc" and the 3rd character of "aec".
  3. Select the 1st character of "aec" and the 3rd character of "adc".
  4. Select the 1st character of "aec" and the 3rd character of "aec".

Read more »

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

By meiniak, history, 7 months ago, In English,

How to solve today's atcoder contest problem. Also i have seen many people codes there is something they use like Mint? What is it

Read more »

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

By meiniak, history, 7 months ago, In English,

I got always confused on how to leviate in-built stl function to use upper and lower bound. For eg: in yesterday previous B question I wrote my own upperBound on vector pair.

I think mostly there are 3 variation:

lowerbound on pair with smallest index lowerbound on pair with largest index

upperbound pair with smallest index

Thanx codeforces

Read more »

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

By meiniak, history, 10 months ago, In English,

Problem Link . I tried to solve this problem but couldn't solve it. Try to read editorial using google translate help me nothing.

Read more »

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

By meiniak, history, 13 months ago, In English,

I just want to use priority queue with pair of integers such that it stores the maximum product of 2 numbers in descending order . How can i use it in C++ .

For Eg : —

2 5

5 10

3 6

will be save in priority queue as

5 10

3 6

2 5

and if a clash happen , then the first element should be prefer .

Also I was solving this problem using priority queue but getting WA at case 30 , strange RUNTIME error for comparison but it passes using vector of pairs . I just found on the net on how to write custom comparison function for priority queue . Is there any other method without using class or struct .

Read more »

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