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:TLE了,哪位仁兄帮帮我看一下:

Posted by fishing_test at 2009-05-19 15:38:52 on Problem 2259
In Reply To:TLE了,哪位仁兄帮帮我看一下: Posted by:zhb_msqx at 2007-09-18 17:18:03
 you can using int[1000000] array to hold the team information.
 for input 
 
 2
 3 101 102 103
 3 201 202 203

 then a[101] = 1; a[102] = 1; a[103] = 1; a[201] = 2, a[202] = 2; a[203] = 2;

 Then you can follow the queue to simulate.

 List<List> hold the queue.

 when find the team, you only need to compare the value between,
team[coming value] == list.get(j).get(0);


  the rest is very simple.
 

 

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