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

79MS水过~~~

Posted by 456852456852 at 2011-08-03 01:35:23 on Problem 2513 and last updated at 2011-08-06 15:52:43
几句牢骚...
1. 题目要求判断无向图是否存在欧拉通路或欧拉回路, 由于是无向图, 所以直接统计每个顶点的度数就好, 而不用专门去统计出度和入度;
2. 用getchar()代替scanf()或gets()可以大幅度提高效率;
3. 如果度数为奇(用 &1 代替 %2 提高速度)的顶点数不是0也不是2, 那么直接Impossible, 不用再去判图连通了, 这样可以省去很多时间;
4. 刚学了Trie树, 试了之后发现用数组实现的话比动态内存实现的要快得多;
5. 这题的并查集用启发式合并的话反而要慢一些, 所以随便合并就行了;
6. 由于顶点的数目不会超过5w个, 所以有些大数组直接用unsigned short好了.

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