Skip to content

Commit 15329fc

Browse files
committed
cf update
1 parent 78171c3 commit 15329fc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Codeforces/Div II/278B_170.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
n = gets.to_i;
2+
a = (0..n-1).inject([]) {|acc, y|
3+
s = gets.chomp
4+
b = (0..s.length-1).inject([]){ |ai, x|
5+
(x..s.length-1).inject(ai){ |aj, y|
6+
aj << s[x..y]
7+
}
8+
}
9+
acc + b
10+
}.sort{ |x, y|
11+
if x.size < y.size
12+
-1
13+
elsif x.size > y.size
14+
1
15+
else
16+
if x <= y then -1 else 1 end
17+
end
18+
}.uniq
19+
ans="a"
20+
a.each{|x|
21+
break if x != ans
22+
ans.succ!
23+
}
24+
puts ans
25+

0 commit comments

Comments
 (0)