Hi, I submitted this code for the problem Chef and Semi-Primes:
import sys
def part(num):
sum = []
for i in range(1, int(num/2)+1):
sum.append([i,num-i])
return sum
def isSum(n):
pts = part(n)
semi = [6, 10, 14, 15, 21, 22, 26, 33, 34, 35, 38, 39, 46, 49, 51, 55, 57, 58, 62, 65, 69, 74, 77,
82, 85, 86, 87, 91, 93, 94, 95, 106, 111, 115, 118, 119, 122, 123, 129, 133, 134, 141, 142,
143, 145, 146, 155, 158, 159, 161, 166, 177, 178, 183, 185, 187]
tr = True
for i in pts:
if len(i) == 2 and i[0] in semi and i[1] in semi: print('YES'); tr = False; break;
if tr: print('NO')
inp = sys.stdin.readlines()
inp = inp[1:]
for i in inp:
isSum(int(i))
The problem is at CodeChef: Practical coding for everyone
After the competition, I checked my code with the other correct code and yet I was told my solution is incorrect. Is it my output or something like that? Thank you for any help you can give me.