This is my solution for this problem, but I keep running into runtime error.
https://www.codechef.com/viewsolution/39813440
Can anyone please check and see where the issue lies ?
This is my solution for this problem, but I keep running into runtime error.
https://www.codechef.com/viewsolution/39813440
Can anyone please check and see where the issue lies ?
getPrimeFactor() is wrong, if you take x = 19, then then value of ‘i’ would become greater than size of allPrimes and so the codes encounters runtime error.
Actually, I thin you missed or misinterpreted the problem a bit, so I am pointing out two statements from the problem here:
So, if you take 1 worker in each team, you would be ending up submitting the task in 1 day, as all of your K teams will submit in 1 day and since all teams submitted, the board will accept it. But that’s not your task, you want all the teams to submit on Xth day simultaneously so that it’s accepted on Xth day and not on 1st day.
Hope it helps.
can anyone please help me in finding why my code is not accepted. Link to my code:
https://www.codechef.com/viewsolution/39772755
this is my code, i am getting wa
import math
def primeFactors(n):
a=[]
b=1
d=0
while n % 2 == 0:
b = b2
n = n / 2
d=1
if d==1:
a.append(b)
b=1
d=0
for i in range(3,int(math.sqrt(n))+1,2):
while n % i== 0:
b=bi
n = n /i
d=1
if d==1:
a.append(b)
b=1
d=0
if n > 2:
a.append(int(n))
return(a)
t = int(input())
for i in range(t):
a = list(map(int,input().split()))
w = a[0]
s = a[1]
f = primeFactors(s)
f.sort()
x=[1]*w
gg = 1
d=0
for i in range(len(f)-1,-1,-1):
ini = x.index(min(x))
x[ini] = x[ini]*f[i]
print(sum(x))
Can anyone help me understand the time complexity of the brute force solution used in the video?
Can someone help me in getting the test case in which my code is failing ??
It passed every test case which is discussed above.