| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:我的更郁闷,只是进行了一个预处理,还没有匹配就RE了,还请大虾指点。(符代码)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator