11222 - Only I did it!
Posted: Mon Jun 11, 2007 9:19 pm
What is the output for this input:
2
3 1 2 3
3 4 5 6
3 7 8 9
3 7 8 9
3 7 8 9
3 7 8 9
Thanks.
Sapnil
2
3 1 2 3
3 4 5 6
3 7 8 9
3 7 8 9
3 7 8 9
3 7 8 9
Thanks.
Sapnil
Code: Select all
Case #1:
1 3 1 2 3
2 3 4 5 6
3 3 7 8 9
Case #2:
1 0
2 0
3 0
Code: Select all
4
3 1 2 3
3 2 1 3
3 0 1 2
3 3 2 1
3 4 2 1
4 5 9 6 2
2 1 0
2 1 0
2 1 0
3 4 6 5
3 6 5 4
3 9 8 7
my accepted answer
Case #1:
3 1 0
Case #2:
3 3 5 6 9
Case #3:
1 0
2 0
3 0
Case #4:
3 3 7 8 9
Code: Select all
Code removed. Silly mistake
Code: Select all
AC now
Code: Select all
2
0
1 8
1 8
2 1 3
2 1 3
1 1
My AC program gives the following output:allenlam wrote:For the above input, what's the correct output?
Code: Select all
Case #1:
1 0
2 0
3 0
Case #2:
1 0
2 0
3 0
Thanks for sharing these test cases. This was really helpful.Parleen wrote:while i was trying to post my wrong answer code here, i tried to make some test case to post here and suddenly found my very silly mistake. but this test can really help anybody.
Code: Select all
Got AC
Code: Select all
1
1 1
1 2
0
Code: Select all
Case #1:
1 1 1
2 1 2
Code: Select all
if __name__ == '__main__':
n = int(input())
for i in range(1, n + 1):
print("Case #", i, ":", sep = "")
f1 = set(input().split()[1:])
f2 = set(input().split()[1:])
f3 = set(input().split()[1:])
s1 = f1.difference(f2, f3)
s2 = f2.difference(f1, f3)
s3 = f3.difference(f1, f2)
t = []
l = []
if len(s1) >= len(s2) and len(s1) >= len(s3):
l.append(list(map(int, s1)))
t.append(1)
if len(s2) >= len(s1) and len(s2) >= len(s3):
l.append(list(map(int, s2)))
t.append(2)
if len(s3) >= len(s1) and len(s3) >= len(s2):
l.append(list(map(int, s3)))
t.append(3)
for el, tt in zip(l, t):
el.sort()
if len(el) == 0:
print(tt, "0")
else:
print(tt, len(el), " ".join(map(str, el)))