Mr_No_One's blog

By Mr_No_One, history, 6 months ago, In English

I am solving a question from CSES sum of four values. I found out the time complexity to be O(n^3) and n is 1000. But most of the solutions are within 0.12 seconds. Where I am going wrong with the calculation of time complexity.

Question is :: You are given an array of n integers, and your task is to find four values (at distinct positions) whose sum is x. CSES question link

The approach i am using is to store index of each element in unordered_map and then traverse the array using three loops to find three elements a1 , a2 , a3 and then check if sum-(a1+a2+a3) exists in map. It seems to be O(n^3) or O(n^3 *log n) with map , but it is getting passed within .12 or max .4 seconds. Shouldn't it get TLE verdict when n is 1000. Making O(1000000000).

I would like to know where I am wrong with the calculations.

Read more »

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

By Mr_No_One, history, 7 months ago, In English

I am using the following code to generate TC for hacks for question E of round 640 but the hacking verdict is generator crashed. What does it mean and where I am going wrong.

Link of the crash log https://imgur.com/alUVkUY

from random import randint as rd
print(10)
for i in range(10):
	print(800)
	for j in range(799):
		print(rd(700,799),end=' ')
	print(rd(700,799))
			

Read more »

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

By Mr_No_One, history, 8 months ago, In English

During the last contest (Codeforces Round #634 div3) for the solution of ques D, I submitted multiple solutions which differ from each other very slightly (in order to micro -optimize code to reduce execution time). Now I recieved an email from codeforces that I have cheated. This feels very wrong as I never cheat. Please look into the matter @MikeMirzayanov

https://imgur.com/R9Wed5I

Read more »

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

By Mr_No_One, history, 16 months ago, In English

I am just seeing HACKED in verdict . How to see whether it was a TLE or WA or some other reason?

Read more »

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