CROC 2016 - Qualification


A. Parliament of Berland
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 2
Output
0 3
1 2
Input
8 4 3
Output
7 8 3
0 1 4
6 0 5
0 2 0
Input
10 2 2
Output
-1
----------------------------------------------------------------------------------------------------
B. Processing Queries
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
2 9
4 8
10 9
15 2
19 1
Output
11 19 -1 21 22 
Input
4 1
2 8
4 8
10 9
15 2
Output
10 18 27 -1 
----------------------------------------------------------------------------------------------------
C. Hostname Aliases
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
http://abacaba.ru/test
http://abacaba.ru/
http://abacaba.com
http://abacaba.com/test
http://abacaba.de/
http://abacaba.ru/test
http://abacaba.de/test
http://abacaba.com/
http://abacaba.com/t
http://abacaba.com/test
Output
1
http://abacaba.de http://abacaba.ru 
Input
14
http://c
http://ccc.bbbb/aba..b
http://cba.com
http://a.c/aba..b/a
http://abc/
http://a.c/
http://ccc.bbbb
http://ab.ac.bc.aa/
http://a.a.a/
http://ccc.bbbb/
http://cba.com/
http://cba.com/aba..b
http://a.a.a/aba..b/a
http://abc/aba..b/a
Output
2
http://cba.com http://ccc.bbbb 
http://a.a.a http://a.c http://abc 
----------------------------------------------------------------------------------------------------
