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:思路分享(63ms未优化)

Posted by lddlinan at 2021-05-17 20:16:27 on Problem 1772
In Reply To:思路分享(63ms未优化) Posted by:jimmyzjx at 2021-04-04 16:59:58
> 【任务一 重建棋盘】dfs,重点是优化:
> 每格有三个状态,未确定?/棋子1/空白0
> 
> dfs中每次都选取*自由度*最低的一组(group),分两种情况
> - 本组没有待定的格点,直接填上相应状态(分为棋子和空白两种子情况)
> - 本组有待定格点,遍历尝试填比较少的那种状态(例如本组共5个,应有2棋子3空白,那么就填棋子)
> 
> *自由度* 表示每组当中剩余棋子或空白数量较少的那个,
> 即 min(num0ToFillInGroup[g], num1ToFillInGroup[g])
> 
> 另外在选定某组后持续选该组,直到全部填完再选下一组(不确定是优化还是负优化)
> 
> 代码不是很好看,毕竟不是专业OIer:
> https://gist.github.com/JimmyZJX/88d272232d3980b2536aa44f484d5b72

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