|
Menu |
|
Задача Who are you, mister Graph?
| Файл входного файла: | mrgraf.in |
|---|---|
| Файл выходного файла: | mrgraf.out |
| Ограничение по памяти: | 64 MB |
| Ограничение по времени: | 2 s |
Описание
Given degrees of a graph vertices, determine whether they conform to any undirected graph.
If so - output it. It is guaranteed that in the case when the graph exists, the number of edges does not exceed 500000. The graph should not contain loops and multiple edges.
Формат входных данных
The first line of the input file contains an integer N - the number of vertices in the graph (1 < N <= 10000).
N numbers are written in the next line:
- the degrees of vertices (0 <= d
i
<= 10000). Numbers in the line are separated by spaces.
Формат выходных данных
Write "YES" or "NO" - depending on the existence of a graph.
If yes, the first line should contain M - the number of edges in the resulting graph, and the following M lines must contain the description of each edge - numbers of vertices, that are the ends of the corresponding edge. Vertices are numbered starting from one in the order they are given in the input file.
If there are multiple graphs satisfying the condition, output any.
Примеры:
| ввод | вывод |
|---|---|
|
4
|
YES
|
|
|
|
Difficulty: 6.66201153438
Accepted: 6
Submitted: 112
Источник задачи: KBTU OPEN 2010 SPRING
Обсуждение:
Начать обсуждение:
Powered by django, eJudge.
u menya vrode bi vse pravil'no, no na 20-om teste WA?
Дата: 2010-05-16 19:51
Ответить →