1873 - Depth of the Pages 1873 - Profundidad de las Páginas 1873 - Depth of the Pages

Statistics Sub: 541 | AC: 278 | AC%: 51,39 | Score: 0,75
Created by Yonny Mondelo Hernández
Added by ymondelo20 (2012-06-05)
Limits
Total Time: 10000 MS | Test Time: 3000 MS |Memory: 62 MB | Output: 64 MB | Size: 29 KB
Enabled languages
Available in

Description



The web is a collection of billions of documents written in such a way that can be cited using hyperlinks, forming the so-called hypertext. Such documents or web pages have many characters written in numerous languages and cover essentially all subjects of human knowledge.



At present, the web is one of the principal means of disseminating information. Nowadays web pages are containers of programs, compressed files, text documents, multimedia files such as images, videos, animations, and sounds, among others. They are built using different programming languages and are supported by different types of web servers. Therefore, we would not be in error to assert that the web is a reflection of the major trends that are followed by most users for the use of Information Technology.

                                 

In the last study conducted on the websites of the University of Informatics Sciences, was detected more than 99.75% of the web pages are among the logical depth 1 and 10. The logical depth of a web page is related to the minimum number of times the user has to click on any link to get to it without leaving the website and starting from the home page. The home page of a website has a logical depth one, and web pages that are accessible directly from the home page have logical depth two, and so on.

The study, among other things, allowed us to develop a navigation map for each of the websites studied. It has also developed a software capable of determining the logical depth of a web page, from the navigation map of the website to which it belongs. It was decided to test the software on sites that contain no more than 50 web pages, and we want that you develop a similar software for comparing the obtained results.
;jsessionid=E85135568D5CEF22BA246EFB310D90BB


La web es una colección de miles de millones de documentos escritos de tal manera que se pueden citar utilizando hipervínculos, formando el llamado hipertexto. Dichos documentos o páginas web tienen muchos caracteres escritos en numerosos idiomas y cubren esencialmente todos los temas del conocimiento humano.



En la actualidad, la web es uno de los principales medios de difusión de información. Hoy en día, las páginas web son contenedores de programas, archivos comprimidos, documentos de texto, archivos multimedia como imágenes, videos, animaciones y sonidos, entre otros. Se crean utilizando diferentes lenguajes de programación y son compatibles con diferentes tipos de servidores web. Por lo tanto, no nos equivocaríamos al afirmar que la web es un reflejo de las principales tendencias seguidas por la mayoría de los usuarios para el uso de la tecnología de la información.

                                 

En el último estudio realizado en los sitios web de la Universidad de Ciencias Informáticas, se detectó que más del 99.75% de las páginas web se encuentran entre la profundidad lógica 1 y 10. La profundidad lógica de una página web está relacionada con el número mínimo de veces que el usuario debe hacer clic en cualquier enlace para acceder a ella sin abandonar el sitio web y comenzando desde la página de inicio. La página de inicio de un sitio web tiene profundidad lógica uno, y las páginas web a las que se puede acceder directamente desde la página de inicio tienen una profundidad lógica dos, y así sucesivamente.

El estudio, entre otras cosas, permitió desarrollar un mapa de navegación para cada uno de los sitios web estudiados. También un software capaz de determinar la profundidad lógica de una página web, a partir del mapa de navegación del sitio web al que pertenece. Se ha decidido probar el software en sitios que no contengan más de 50 páginas web, y queremos que usted desarrolle un software similar para comparar los resultados obtenidos.

;jsessionid=E85135568D5CEF22BA246EFB310D90BB


The web is a collection of billions of documents written in such a way that can be cited using hyperlinks, forming the so-called hypertext. Such documents or web pages have many characters written in numerous languages and cover essentially all subjects of human knowledge.



At present, the web is one of the principal means of disseminating information. Nowadays web pages are containers of programs, compressed files, text documents, multimedia files such as images, videos, animations, and sounds, among others. They are built using different programming languages and are supported by different types of web servers. Therefore, we would not be in error to assert that the web is a reflection of the major trends that are followed by most users for the use of Information Technology.

                                 

In the last study conducted on the websites of the University of Informatics Sciences, was detected more than 99.75% of the web pages are among the logical depth 1 and 10. The logical depth of a web page is related to the minimum number of times the user has to click on any link to get to it without leaving the website and starting from the home page. The home page of a website has a logical depth one, and web pages that are accessible directly from the home page have logical depth two, and so on.

The study, among other things, allowed us to develop a navigation map for each of the websites studied. It has also developed a software capable of determining the logical depth of a web page, from the navigation map of the website to which it belongs. It was decided to test the software on sites that contain no more than 50 web pages, and we want that you develop a similar software for comparing the obtained results.
;jsessionid=E85135568D5CEF22BA246EFB310D90BB

Input specification

First line contains an integer 1 <= T <= 100 which is the number of test cases (websites). Following this T-cases exist.
For each test case the first line contains three integers: 1 <= N <= 50, 1 <= L <= 500, and 1 <= Q <= N, denoting the number of web pages (conveniently numbered between 1 and N, the home page is always the number one), the number of links, and the number of tests respectively. Following this L lines exist: each line consist of two space separated integer numbers 1 <= S <= N and 1 <= D <= N denoting the source and the destiny of one link. Following this Q lines exist: each line consist of an integer number 1 <= P <= N denoting any web page, selected for testing.
La primera línea contiene un entero 1 <= T <= 100, que es el número de casos de prueba (sitios web). Luego siguen T casos. Para cada caso de prueba, la primera línea contiene tres enteros: 1 <= N <= 50, 1 <= L <= 500 y 1 <= Q <= N, que denotan el número de páginas web (convenientemente numeradas entre 1 y N, la página de inicio es siempre será la número uno), la cantidad de enlaces y la cantidad de pruebas, respectivamente. Siguiendo esta habrán L líneas: cada línea consiste en dos números enteros separados por espacios 1 <= S <= N y 1 <= D <= N que denotan la fuente y el destino de un enlace. Siguiendo esta habrán Q líneas: cada línea consiste en un número entero 1 <= P <= N que denota alguna página web, seleccionada para la prueba.
;jsessionid=E85135568D5CEF22BA246EFB310D90BB
First line contains an integer 1 <= T <= 100 which is the number of test cases (websites). Following this T-cases exist.
For each test case the first line contains three integers: 1 <= N <= 50, 1 <= L <= 500, and 1 <= Q <= N, denoting the number of web pages (conveniently numbered between 1 and N, the home page is always the number one), the number of links, and the number of tests respectively. Following this L lines exist: each line consist of two space separated integer numbers 1 <= S <= N and 1 <= D <= N denoting the source and the destiny of one link. Following this Q lines exist: each line consist of an integer number 1 <= P <= N denoting any web page, selected for testing.

Output specification

For each web page selected for testing you must print one line with an integer number representing the logical depth of the same, or -1 if that web page is impossible to reach.
Para cada página web seleccionada para la prueba, debe imprimir una línea con un número entero que represente la profundidad lógica de la misma, o -1 si es imposible acceder a esa página web desde la página de inicio.
;jsessionid=E85135568D5CEF22BA246EFB310D90BB
First line contains an integer 1 <= T <= 100 which is the number of test cases (websites). Following this T-cases exist.
For each test case the first line contains three integers: 1 <= N <= 50, 1 <= L <= 500, and 1 <= Q <= N, denoting the number of web pages (conveniently numbered between 1 and N, the home page is always the number one), the number of links, and the number of tests respectively. Following this L lines exist: each line consist of two space separated integer numbers 1 <= S <= N and 1 <= D <= N denoting the source and the destiny of one link. Following this Q lines exist: each line consist of an integer number 1 <= P <= N denoting any web page, selected for testing.

Sample input

2
5 5 3
1 2
1 3
1 4
3 5
5 1
1
3
5
3 3 3
1 2
2 3
1 3
1
2
3

Sample output

1
2
3
1
2
2

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 3518 | 3828 | 2929 | 3423 | 2329 | 2736