随笔分类 - 算法->搜索
关于深搜与宽搜的奇技淫巧
    
摘要:题解 还以为是啥毒瘤题 然后是个搜索题 复杂度算起来挺大 然后跑起来就连0.1ms不到= = 就是从大到小进行每种操作,搜出来一种操作就乘上一个操作数的阶乘就行 如果现在进行的操作操作$2^i$那么大的段,那么就把序列分成每段$2^{i + 1}$长,看看每段是否连续 如果都连续这次操作就跳过 如果
        阅读全文
                
摘要:题解 什么,我这题竟然快到了LOJ rk1???? 搜起来有点麻烦,不过感觉还是比斗地主好下手(至今没敢写斗地主 首先是暴力搜牌型,最多$3^{16}$(什么判解还要复杂度怂成一团)的样子?? 然后判牌型,显然只要考虑单牌,和3 + x,4+2 然后暴力搜网友的3和4 暴力搜jry的3和4 然后枚举
        阅读全文
                
摘要:题解 从每个质因子小到大指数非严格递减,直接搜就行 代码
        阅读全文
                
摘要:题解 看完题目我的第一个反应是……要求最小花费的方案?!怎么求??? 然后我把题读完了。好吧。 记录一下size就行,比NOIP普及组还要不如的题= = 代码 cpp include include include include include include define enter putch
        阅读全文
                
摘要:题解 发现似乎相当于问一个2000个元的方程组有没有解…… 然而我懵逼啊…… 发现当成图论,两个点之间连一条边,开始BFS,每个点的值赋成边权减另一个点的点权 如果一个环不合法那么肯定无解 代码 cpp include include include include include include 
        阅读全文
                
摘要:题解 (搬运一个原来博客的论文题) 抱着板题的心情去,结果有大坑 就是S == T的时候也一定要走,++K 我发现按照论文写得$O(n \log n + m + k \ log k)$算法没有玄学A 快,不开心啊(或者我松教水平不高啊) 论文里主要是怎么样呢,把所有边反向,从T开始求最短路,然后求一
        阅读全文
                
摘要:题解 写完之后开始TTTTTTT……懵逼 这道题我们考虑一个东西叫容斥系数啊 啥玩意啊怎么求啊 我们显然可以$n^2$的递推求出来,类似解方程 但是我们打个表就会发现是$f_{i} = ( 1)^{i 1}(i 1)!$ 然后我们再考虑这个式子的容斥意义,假如一个图有m个联通块,那么我们会计算有i个
        阅读全文
                
摘要:题解 我是榜上最后一名= = 可能高精度用vector太慢了吧……什么破题= = 这道题很简单,如果高精度熟练代码……也很简单……然而,参数调了好久 我们发现质数的指数一定是,质数越小,指数越大,这个很显然我不说了 所以我们就用个优先队列BFS就好,队列按数从小到大排序,每次把队列的数取出来作为下一
        阅读全文
                
摘要:我居然每道题都能想出来 虽然不是每道题都能写对,debug了很久/facepalm C Many Medians 排序后前N/2个数的中位数时排序后第N/2 + 1的数 其余的中位数都是排序后第N / 2的数 cpp include include include include include i
        阅读全文
                
摘要:原题戳这里 题解 搜索是个好东西,不是人人都会搜 迭代加深,然后用一个函数估值,值是除了和左上连通的部分还有几个颜色不同的块,如果走的步数加上估值大于当前枚举的深度就跳出 代码 cpp include include include include include include define MA
        阅读全文
                
摘要:Checker Challenge Examine the 6x6 checkerboard below and note that the six checkers are arranged on the board so that one and only one is placed in ea
        阅读全文
                
摘要:Consider nine clocks arranged in a 3x3 array thusly: The goal is to find a minimal sequence of moves to return all the dials to 12 o'clock. Nine diffe
        阅读全文
                
摘要:A square arrangement of numbers is a 5 x 5 Latin Square because each whole number from 1 to 5 appears once and only once in each row and column. Write
        阅读全文
                
摘要:In the square below, each row, each column and the two diagonals can be read as a five digit prime number. The rows are read from left to right. The c
        阅读全文
                
摘要:It's spring in Wisconsin and time to move the yearling calves to the yearling pasture and last year's yearlings to the greener pastures of the north 4
        阅读全文
                
摘要:[International readers should note that some words are puns on cows.] Having made a fortune on Playbov magazine, Hugh Heifer has moved from his origin
        阅读全文
                
摘要:The cows of Farmer Brown and Farmer John are planning a coordinated escape from their respective farms and have devised a method of encryption to prot
        阅读全文
                
摘要:Farmer John is trying to erect a fence around part of his field. He has decided on the shape of the fence and has even already installed the posts, bu
        阅读全文
                
摘要:Shaping Regions N opaque rectangles (1 <= N <= 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectan
        阅读全文
                
摘要:Farmer John must measure Q (1 <= Q <= 20,000) quarts of his finest milk and deliver it in one big bottle to a customer. He fills that bottle with exac
        阅读全文
                
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号