```
# -*- coding:utf-8 -*-
import logging
import sys
from logging.handlers import RotatingFileHandler
import os class InfoFilter(logging.Filter): def ... ...
分类:
编程语言 时间:
2019-02-03 22:14:00
阅读次数:
239
算法描述: Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in ...
分类:
其他好文 时间:
2019-02-01 11:31:28
阅读次数:
207
题目大意 链接: "CF533E" 给一张$n$个点,$m$条边的图,起点$1$终点$n$,如果不能在$T$的时间内到达则需支付$X$的代价。 走每条边都会支付一定代价,经过一条边$i$的时间有$p_{i,j}$的概率为$j$,最小化期望代价。 题目分析 暴力方法:期望DP 设$f_{i,j}$表示 ...
分类:
其他好文 时间:
2018-11-29 21:46:25
阅读次数:
161
题目分析 期望$\text{dp}$。 设$f_{i,j}$表示在第$j$个时刻从$i$点出发,到达终点的期望花费。 有转移方程: $$ f_{x,t}=\min_{(x,y)\in E}(c_{x,y}+\sum_{i=1}^Tp_{y,i}\cdot f_{y,i+t}) $$ 如果直接转移,时 ...
分类:
其他好文 时间:
2018-11-28 15:32:29
阅读次数:
179
Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black til ...
分类:
其他好文 时间:
2018-11-04 01:45:56
阅读次数:
190
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segme ...
分类:
其他好文 时间:
2018-10-28 11:16:28
阅读次数:
135
白书第一章例题8 好麻烦! 正方体每面编号为0-5,那么根据顶点和正面,就能确定形态。一共6*4=24种形态。 P[i]表示编号i所在位置。比如P[1]=3,表示第二面转到了第四面。 就可以表示出所有形态。 这时候可以手算或者写个函数找出所有形态。 注意选择函数计算,要放到main外面,方便调。 注 ...
分类:
其他好文 时间:
2018-10-27 14:55:43
阅读次数:
168
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or ...
分类:
其他好文 时间:
2018-10-23 23:06:33
阅读次数:
173
题意: 就是无向图欧拉路 解析: 不能用map。。超时 在判断是否只有一个联通的时候,我比较喜欢用set,但也不能用set,会超时,反正不能用stl emm 用trie树来编号就好了 ...
分类:
其他好文 时间:
2018-10-09 18:09:10
阅读次数:
145
题目大意:将n个数分解成若干组,如4 = 2+2, 7 = 2+2+3,保证所有组中数字之差<=1。 首先我们能想到找一个最小值x,然后从x+1到1枚举并check,找到了就输出。这是40分做法。 能不能优化?我们发现,若k合法,那么x%k==0或x%(k+1)==0或x%(k-1)==0。 所以枚 ...
分类:
其他好文 时间:
2018-10-03 22:18:02
阅读次数:
451