2003 Canadian Computing Competition, Stage 2
Day 2, Problem 2: Longest SubstringWithin a sequence S of integers, find the longest contiguous subsequence that contains every integer at most once.
In other words, find the longest contiguous subsequence in which no integer is repeated. If there are several such subsequences, find the one that occurs first in S.
InputThe input will consist of the elements of S, one per line, in sequence, followed by 0.
Each element of S is a positive integer less than 65536. You should not assume anything about the length of S.
OutputThe output should contain the correct subsequence of S, one element per line.
1 9 5 3 1 2 8 3 9 0
9 5 3 1 2 8
Point Value: 20 (partial)
Time Limit: 2.00s
Memory Limit: 3M
Added: Dec 28, 2008
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3