本来想比赛的~可是睡着了~5555555555555
CssPropertyConverter
http://www.topcoder.com/stat?c=problem_statement&pm=7503&rd=10664
简单的字符串转化问题,没什么意思
ProblemsToSolve
http://www.topcoder.com/stat?c=problem_statement&pm=7504&rd=10664
一道枚举题目,不过据说可以O(n)的dp,没怎么看明白
CsCourses
http://www.topcoder.com/stat?c=problem_statement&pm=7505&rd=10664
dp的题,看了标程,感觉写的太好了,应该背下来
int dp(int curtheoretical,int curpractical,int curmonth) {
if(curtheoretical>=skillBound&&curpractical>=skillBound) return 0;
if(curmonth>=(int)theoreticalValue.size()) return INF;
if(done[curtheoretical][curpractical][curmonth]) return cache[curtheoretical][curpractical][curmonth];
else done[curtheoretical][curpractical][curmonth]=true;
int ret=INF;
for(int i=0;i<(int)theoreticalValue.size();++i)
if(curtheoretical>=theoreticalValue[i]-1&&curpractical>=practicalValue[i]-1&&curmonth<expire[i]) {
int cur=dp(max(curtheoretical,theoreticalValue[i]),max(curpractical,practicalValue[i]),curmonth+1)+1;
if(cur<ret) {
ret=cur;
bestcourse[curtheoretical][curpractical][curmonth]=i;
}
}
return cache[curtheoretical][curpractical][curmonth]=ret;
}
vector<int> construct() {
vector<int> ret;
int curtheoretical=0,curpractical=0,curmonth=0;
while(curtheoretical<skillBound||curpractical<skillBound) {
int course=bestcourse[curtheoretical][curpractical][curmonth];
ret.push_back(course);
curtheoretical=max(curtheoretical,theoreticalValue[course]);
curpractical=max(curpractical,practicalValue[course]);
++curmonth;
}
return ret;
}
VegetableGarden
http://www.topcoder.com/stat?c=problem_statement&pm=7507&rd=10664
要解决几个问题
1:怎么判断走的路径不自交
根据题中所说,所有自交的路径都可以用不自交的方法表示出来,所以这个问题不用考虑
2.:怎么判断点是否被围在多边形里
One way to do this is to draw a line from the point in an arbitrary direction, and test if the number of lines of the polygon it intersects is even (outside the polygon) or odd (inside the polygon).
3:用状态压缩的方法表示每个关注的点上方的边数(1为奇,0为偶),并且预处理得到一个under[x][y]数组表示在(x,y)到(x,y+1)这条直线对所有关注的点来说是在上方还是在下方。
4:bfs实现所有结点的遍历51*51*2^10,并且用一个数组记录最优值。