Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:我的更郁闷,只是进行了一个预处理,还没有匹配就RE了,还请大虾指点。(符代码)

Posted by xuchen_cug at 2006-10-05 10:00:05 on Problem 1469
In Reply To:我的更郁闷,只是进行了一个预处理,还没有匹配就RE了,还请大虾指点。(符代码) Posted by:archenxu at 2006-10-04 21:44:07
> import java.util.*;
> 
> class Node {
> 	int v, next;
> 	Node(int v, int next) {
> 		this.v = v; this.next = next;
> 	}
> }
> 
> public class Main {
> 	
> 	static final int xcnt = 101;
> 	static final int ycnt = 301;	
> 	static Node[] list = new Node[xcnt*ycnt];
> 	static int[] adj = new int[xcnt];
> 	static int[] ans = new int[ycnt];
> 	static boolean[] flag = new boolean[ycnt];
> 	static int n;
> 
> 	public static void main(String[] args) {
> 		for ( int i = xcnt*ycnt - 1; i >= 0; i-- ) {
> 			list[i] = new Node(0, 0);
> 		}		
> 		Scanner cin = new Scanner(System.in);
> 		int kase = cin.nextInt();
> 		int p, i, j, k, tl;
> 		boolean fg;
> 		while ( 0 != kase-- ) {
> 			p = cin.nextInt();
> 			n = cin.nextInt();
> 			tl = 1;
> 			if (p > n) fg = false;
> 			else fg = true;	
> 			Arrays.fill(adj, 0);
> 			for (i = 1; i <= p; i++) {
> 				k = cin.nextInt();
> 				if ( k == 0 ) fg = false;
> 				while ( 0 != k-- ) {
> 					j = cin.nextInt();
> 					list[tl].next = adj[j];
> 					list[tl].v = j;
> 					adj[j] = tl++;
> 				}
> 			}
> 			if ( !fg ) {
> 				System.out.println("NO"); continue;
> 			}			
> 			Arrays.fill(ans, 0);
> 			for ( i = 1; i <= p; i++ ) {
> 				Arrays.fill(flag, false);
> 				//if ( !match(i) ) break;
> 			}
> 			if ( i <= p ) System.out.println("NO");
> 			else System.out.println("YES");
> 		}
> 	}
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator