← Back to topics
Topic

z-names

k
kinezizbosne
Can someone give me idea for solving this task:
http://z-trening.com/tasks.php?show_task=5000000444

d
demjan0001
Offline idea:
Sort all names with their positions.
And for i-th element in sorted array find how many elements before it has position smaller than it's.

Online idea:
Use Trie with some dynamic programming...