1 / 4
Mar 2016

i have written this code down and it works effectively in Ideone without any error but when running on SPOJ it is showing WRONG ANSWER
can anyone help please ,m code is:
m=input()
list1 = map(int,raw_input().split())
n=input()
list2 = map(int,raw_input().split())
list3= set(list1).difference(list2)
list4=[]
for x in list3:
list4.append(x)
for x in list4:
print int(x),

  • created

    Mar '16
  • last reply

    Jan '20
  • 3

    replies

  • 1.8k

    views

  • 3

    users

Your code is broken. Please correct your post. Select the complete code and click preformatted. indentation is very important in Python.

thanks daft_wullie,got it corrected :slight_smile:
i missed that sorting part

3 years later

Hi,

I have done it in python. It works fine but I am getting it as wrong answer in SPOJ. I did not get , where is it going wrong. Can you help me find the my mistake?

My code,

n = int(input("Total n cases : "))

if(2 <= n <= 100):
fl = []
fl = [int(x) for x in input().split(’ ')[:n]]

m = int(input("Total m cases : "))
if(2 <= m <= 100):
    sl = []
    sl = [int(x) for x in input().split(' ')[:m]]
    res = []
    for i in range(n):
        if(fl[i] not in sl):
            res.append(fl[i])
    res.sort()

    for i in res:
        print(i, end=' ')