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

Автор Don_quixxote, история, 9 месяцев назад, По-английски
Problem 1

Given a binary string find no. of subsequence of length 3 such that no two adjacent characters are same(101, 010). N <= 1e5

Problem 2

Given an array we want to make it non-increasing by doing following operation one at a time :- - you can shift 1 from a[i] to a[i+1], after that a[i]->a[i]-1 and a[i+1]->a[i+1]+1 (if i+1<n) - you can shift 1 from a[i] to a[i-1], after that a[i]->a[i]-1 and a[i-1]->a[i-1]+1 (if i-1>=0) Calculate minimum moves required to make it non-decreasing. N <= 250. a[i] <= 1e9 Example: a[] = [5 3 2 3 3 3] -> [4 4 2 3 3 3] -> [4 3 3 3 3 3], output is 2

Problem 3

Given an array a[] find no. of array b, such that 1 <= b[i] <= a[i], and no two adjacent element of b are same(b[i] != b[i+1]). Print it modulo (1e9+7) since ans is large. N <= 1e5 a[i] <= 1e6 Example: a[] = [2 3] b[] = [1 2], [1 3], [2 1], [2 3], output is 4

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

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

Автор Don_quixxote, история, 10 месяцев назад, По-английски
Problem 1.
Given an array find no. of non-empty subsequences which does not have three consecutive odd or three consecutive even numbers in subsequence. Since answer is large print it modulo 1e9+7.
Expected time complexity is O(N) or (ONlogN).

hint
code
Problem 2.
A number X is said to be palindrome special, if every digit i present in X occurs exactly i times and digits of X form a palindrome, you are given t test cases (<=1e5) and in each test case integer N(<=1e17). Find nearest greater no. which is a special palindrome.
hint
code

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

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

Автор Don_quixxote, история, 21 месяц назад, По-английски

Can Somebody explain why my code is giving WA on 2nd TC on testCase 38 which is s = "10111" in this problem 1879C - Make it Alternating, even tho i am getting the same output as author's Code. My Submission :- 270768936 Authors code :- 270768479

Output according to author's code is : 2 6 (for 10111) My code also gives the same answer :(

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

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