master
Felix C. Stegerman 2016-09-24 15:00:19 +02:00 committed by Tijdelijke Login
parent 92f4613489
commit 3367825272
1 changed files with 17 additions and 0 deletions

17
i.py Normal file
View File

@ -0,0 +1,17 @@
from __future__ import print_function
import sys
m, s = map(int, sys.stdin.readline().split())
prefs = [ map(int, line.split()) for line in sys.stdin ]
inits = [ set() for x in xrange(m) ]
answer = set()
for j in xrange(s):
for i in xrange(m): answer.add(prefs[i][j])
all_ok = True
for i in xrange(m):
inits[i].add(prefs[i][j])
if len(inits[i]) != len(answer): all_ok = False
if all_ok: break
print(len(answer)); print(" ".join(map(str, sorted(answer))))