You are not logged in. Please login at www.codechef.com to post your questions!

×

Error with CHEFPRMS

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 https://www.codechef.com/SNCKQL19/problems/CHEFPRMS

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.

asked 17 Oct '18, 11:25

omchabra's gravatar image

0★omchabra
01
accept rate: 0%

edited 17 Oct '18, 11:25


When n = 82 Correct output = NO Your Output = YES

link

answered 17 Oct '18, 12:17

vipin1407's gravatar image

5★vipin1407
2045
accept rate: 13%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×4
×2

question asked: 17 Oct '18, 11:25

question was seen: 77 times

last updated: 17 Oct '18, 12:17