Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

adityagamer_alt's blog

By adityagamer_alt, history, 5 weeks ago, In English

https://codeforces.com/contest/1399/submission/229486965

I am iterating on all edges and storing all possible contribution. Then sorting it and using two pointer. Complexity: O(nlogw.log(nlogw)). It is same as jiangly solution. But I am getting Runtime error. I t already tried looking for index out of bounds and memory limit

Full text and comments »

By adityagamer_alt, history, 6 weeks ago, In English

I tried looking for custom hashes but they are making my TL worse.

Submission without custom hash give TLE on test 58 (https://codeforces.com/contest/1806/submission/228273003)

Submission with custom hash gives TLE on test 10 only (https://codeforces.com/contest/1806/submission/228272848)

Tried changing fixed_random to some custom random value but still TLE on test 10 (https://codeforces.com/contest/1806/submission/228273244)

Full text and comments »

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

By adityagamer_alt, history, 7 months ago, In English

By range assignment, I mean setting all values in a range to x

I have been looking for this template but could not find anywhere. The best I have got is when updates is not decreasing the value.

I also tried modifying the lazy segment tree but could not get desired result

Can you share your template

Full text and comments »

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

By adityagamer_alt, history, 8 months ago, In English

Question link

Submission link

My solution is in O(n^2*log(mod)) . It should pass easily

Full text and comments »

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

By adityagamer_alt, history, 8 months ago, In English

What are some necessary templates and topics for Amritapuri regionals?

Full text and comments »

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

By adityagamer_alt, 13 months ago, In English

This code is not passing : link

However this code is passing: link

The only difference between them is line 63

WA code line 62-64
Passing code line 62-64

Since I am printing on cerr I should be getting TLE. And I have used the same template in other problem A,B as well, there it passed

Full text and comments »

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

By adityagamer_alt, history, 14 months ago, In English

I wanted to host a contest with self created questions which anyone can register with the link. I could not find any way by googling. How to do this? Thank you.

Full text and comments »

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

By adityagamer_alt, history, 15 months ago, In English

I just read in the FAQ#6 that we should not create alt account. I created this account just for asking problems. Can my account get banned for this? If yes then please delete my this account, I was unaware of the rule.

Full text and comments »

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

By adityagamer_alt, history, 15 months ago, In English

This submission only took around 1.5 seconds to run atcoder. But in local, for the sample input 3, it is taking 10 seconds. I am using Intel(R) Core(TM) i7-9750H [email protected]

Full text and comments »

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

By adityagamer_alt, history, 15 months ago, In English

Problem link

I understood the editorial except constructing maximal B part. How is he constructing it? Explain please

Full text and comments »

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

By adityagamer_alt, history, 15 months ago, In English

Source: https://www.geeksforgeeks.org/media-net-interview-experience-for-sde-on-campus/

There is some line missing in the problem statement so I am writing here. Also the code for solution is provided but I am not able to understand

We are given strings containing 1 and 2.

When is string a good ? If we are at index i then we can either move a[i] units left or a[i] units right. We have to start at first index and reach last index such that every index is visited once. If we are able to do the it is a good string

Give 2 strings a, b which are initially good. You can select an array of indexes and for each index i, swap(a[i], b[i]). How many ways are there of selecting an array of indexes such that both strings remain good

Main observation
Code of solution(if you are lazy to open link)
Sample test case

Can someone explain the solution please?

Full text and comments »

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

By adityagamer_alt, history, 15 months ago, In English

You are given N. Find number of pairs of integers x, y such that

1 <= x < y <= N and sumOfDigits(x) > sumOfDigits(y)

Constraints:

N <= 10^100 and is given as a string.

Output answer modulo 1e9+7

I don't remember the sign of inequality properly, it might be sumOfDigits(x) < sumOfDigits(y). I read about digit DP to solve this but I cannot find any approach.

How to solve this?

Full text and comments »

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

By adityagamer_alt, history, 16 months ago, In English
  • Vote: I like it
  • -11
  • Vote: I do not like it

By adityagamer_alt, history, 16 months ago, In English
Tags help, wa
  • Vote: I like it
  • -21
  • Vote: I do not like it

By adityagamer_alt, history, 16 months ago, In English

Problem link: https://codeforces.com/problemset/problem/1478/C

In the editorial its given that di exist twice. The proof is given for the existence of pair. Why can't there be 4 values of same di?

Full text and comments »

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

By adityagamer_alt, history, 16 months ago, In English

Problem link: https://leetcode.com/contest/weekly-contest-291/problems/k-divisible-elements-subarrays/

since n <= 200. O(n^3logn) solution should pass but it is giving TLE.

TLE submission link: https://leetcode.com/submissions/detail/751013225/

A few minutes ago, it had got accepted but its not getting accepted now.

AC submission link : https://leetcode.com/submissions/detail/751012624/

Can someone tell me why?

Full text and comments »

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

By adityagamer_alt, history, 17 months ago, In English

Problem link: https://atcoder.jp/contests/abc259/tasks/abc259_b

Submission link(WA): https://atcoder.jp/contests/abc259/submissions/33131531

Submission link(AC): https://atcoder.jp/contests/abc259/submissions/33131108

The only change I have done is how I am calculating the angle. I am getting wrong answer when I use atan, however I am getting AC with atan2.

My atan usage

Full text and comments »

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

By adityagamer_alt, history, 17 months ago, In English
  • Vote: I like it
  • +1
  • Vote: I do not like it