Master0fPuppets's blog

By Master0fPuppets, history, 2 months ago,

Hi guys

I don't know why this solution (https://ideone.com/Q3bmkC) works and this (https://ideone.com/YJx6XI) doesn't

Both are the same idea the problem is just with the mod. I thought in the wrong solution that mod is distributed on multiplication so I didn't write (a[i]%mod *b[i]%mod) instead I wrote it as (a[i]*b[i])%mod so can someone explain it to me why this gave WA!

• -3

By Master0fPuppets, history, 5 months ago,

Hi guys

So my question is simple in this problem the solution is just a simulation to what the problem states but I don't understand why this solution is log n and the tutorial is not clear to me so if anybody could explain it to me.

• +2

By Master0fPuppets, history, 6 months ago,

in this problem https://codeforces.com/contest/1100/problem/B

my solution was to store the frequencies of each number in a map and when the size of the map is = to n I push_back 1 to the string and then decrement the frequencies of each number and if the frequency of a certain number is 0 I erase this number from the map this solution is accepted but my question is why in this code (https://ideone.com/nC7y5D) it gives an error and in this code (https://ideone.com/dUwLsC), it works just fine. please help me if I misunderstand something.

• -12

By Master0fPuppets, history, 7 months ago,

Hi guys! so I was trying to solve this problem and it keeps giving me TLE and I don't know what is the problem with my solution.

My solution: first I store the multiplication of each pair in a vector (v) and then I calculate the gcd of the whole array and then if it is 1 I print -1 else if it is a prime number I print it or I print the first prime factor of it.

• -8

By Master0fPuppets, history, 7 months ago,

Hi guys. in this problem, I thought of storing the prime factors of each number in a counter array for example and after that, I loop over the array and then check if the value of a number is = to the number of pairs (n) then I print that number and if I didn't find such number I print -1. this is what I thought of. I didn't code it cause I think it will give TLE considering the big input. If someone can give me just a hint I don't need a solution.

• -6

By Master0fPuppets, history, 8 months ago,

hi guys in this problem my solution got TLE so if anyone can give me just a hint about what I can edit to get Ac

MY Approach: first I created a vector of sets of size 26 the number of letters and then I did a loop on the whole string and stored the indexes of each letter and then in the queries if the number is one I go to the letter at this index and erase the index from the set and then add this index to the new letter and if the number is two I do a loop over the vector and use lower_bound to check if there is an index in the current letter that is >= l and <= r.Also, I think this solution is O(nlogn) (correct me if I am mistaken)

Thank you in advance :)

• 0

By Master0fPuppets, history, 9 months ago,

In this problem I keep getting MLE and i dont know why Problem:https://codeforces.com/problemset/problem/1409/D Code: https://ideone.com/I2hovY My approach: I am dealing with the number ( n ) as a string and then I compute the sum of digits with a loop and if the sum if less than or equal to s i print 0 and return and if not i simply reverse the string ans start a loop from the beginning of the string and at each index i subtract the number at this index from my total sum and then make this index = 0 and add 1 to the next index and i also run another loop so i could handle the case when at the next index there is a 9 and in case of the last index been set to 0 i push back a 1 to the string. I can't get why this give me MLE and also i dont quite understand what are the reasons of getting MLE .