CodeChef: Codechef
Site under maintenance
  • Register
  • Forgot Password?
  • PRACTICE
    • Easy
    • Medium
    • Hard
  • COMPETE
    • August Mini Challenge
    • August Algorithm Challenge
    • July Algorithm Challenge
    • June Algorithm Challenge
    • May Gamers Challenge
  • DISCUSS
    • Forums
    • Blog
    • Twitter
  • COMMUNITY
    • CodeChef TechTalks
    • CodeChef Meetups
    • Campus Chapters
    • Host Your Contest
    • User Groups
  • HELP
    • Frequently Asked Questions
    • FAQ for Problem Setters
    • Tutorial: Paying Up
    • Tutorial: Small Factorials
    • Tutorial: Input and Output(I/O)
    • Tutorial: Your First Non-Trivial Problem
  • ABOUT
    • About CodeChef
    • About Directi
    • CEO's Corner
    • Press Room
    • Careers

Home » Problems (hard) » Graph Counting

Graph Counting

Problem code: GRAPHCT

  • Submit
  • All submissions

All submissions for this problem are available.

First for some definitions :

Let G = (V,E) be an undirected graph containing an edge e = (u,v) with u ≠ v. Let f be a function which maps every vertex in V\{u,v} to itself, and otherwise, maps it to a new vertex w. The contraction of e results in a new graph G′ = (V′,E′), where V′ = (V\{u,v})∪{w}, E′ = E\{e}, and for every x ∈ V, x′ = f(x) ∈ V′ is incident to an edge e′ ∈ E′ if and only if, the corresponding edge, e ∈ E is incident to x in G.

An undirected graph H is called a minor of the graph G if H is isomorphic to a graph that can be obtained by zero or more edge contractions on a subgraph of G.

A graph is connected if there exists a path between any two vertices. A biconnected graph is one which remains connected even after the removal of any one vertex and all edges incident to it.

A simple graph is one which does not have more than one edge between any pair of vertex, nor does it have an edge from a vertex to itself.

You need to count how many simple biconnected graphs having n vertices and m edges exist such that they do not have a cycle of length 5 as a minor. Two graphs are considered distinct if there exist vertices having labels i and j which are adjacent in the first graph, but not in the second graph.

Input :

The first line contains the number of test cases T. Each of the next lines contains two integers n and m.

Output :

Output T lines, one corresponding to each test case. For a test case, output the number of graphs as described in the question. Output the answer modulo 1000000007.

Sample Input :
5
1 0
3 2
3 3
4 4
5 10

Sample Output :
1
0
1
3
0

Constraints :
1 <= T <= 2000
1 <= n <= 100
0 <= m <= 10000


Date:2010-04-09
Time limit:2s
Source limit:50000B
Languages:All except: TCL


  • Submit

Comments

Loading Comments...

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Loading Submissions...

RECENT ACTIVITY FOR THIS PROBLEM:

Loading Recent Activity...

HELP

Program should read from standard input and write to standard output.

After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:

  • Accepted Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark.
  • Time Limit Exceeded Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
  • Wrong Answer Your program compiled and ran succesfully but the output did not match the expected output.
  • Runtime Error Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section.
  • Compilation Error Your code was unable to compile. When you see this icon, click on it for more information.

If you are still having problems, see a sample solution here.

  • About CodeChef
  • About Directi
  • CEO's Corner
  • Careers
  • feedback@codechef.com

© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs

Sponsors
The time now is: