Induced subgraphs P12120


Statement
 

pdf   zip

Given an undirected graph G=(V,E)G = (V, E), any S⊆VS \subseteq V induces a subgraph G[S]=(S,E′)G[S] = (S, E'), where E′E' contains all edges in EE that join two vertices in SS. Let d(S)d(S) denote the minimum degree of the vertices in G[S]G[S].

You are given a graph GG and a size ss. Which is the maximum degree dd for which there exists some SS with at least ss vertices and such that d(S)≥dd(S) \ge d?

Input

Input consists of several cases, each with the number of vertices nn, the number of edges mm, and mm pairs xyx \enspace y (with x≠yx \ne y), one for each edge of the graph, followed by ss. The vertices are numbered from 0 to n−1n - 1. Assume 1≤n≤1031 \le n \le 10^3, 0≤m≤n(n−1)/20 \le m \le n(n - 1)/2, that there are no repeated edges, and 1≤s≤n1 \le s \le n.

Output

For every case, print the required answer.

Public test cases
  • Input

    6 6
    0 1  1 2  2 0  0 3  1 4  2 5
    3
    
    6 6
    0 1  1 2  2 0  0 3  1 4  2 5
    4
    
    2 1
    1 0
    2
    
    2 0
    2
    
    3 2
    0 1  0 2
    2
    

    Output

    2
    1
    1
    0
    1
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++