|Online MIPT programming contest||РУССКИЙ|
Time limit = 2 second(s)Your are given set of documents. Each document is set of words.
You should find two documents having maximum number of words in their intersection (duplicates should be removed).
Input The first line contains number of documents N, 2 ≤ N ≤ 100. Then N lines follow. Each line contain words delimited by while space. A word could repeat several times in one document. Number of words in one document is less than 501. Word length is up to 100 letters. But average word length is 5 10 letters.
Output The first line should contain max intersection size. Next line two documents identifiers (output any correct pair). Document identifier corresponds to line number in input. The first document has id equal to 0.
3 aa bb cc cc dd bb aa dd gg cc dd dd dd dd cc gg
3 0 1
Artem Voroztsov, Personal MIPT contest, 7 October 2007
4 December 2007
© acm.mipt DevGroup
The page was generated in 220ms