NWERC2016-Problem A(Arranging Hat)】的更多相关文章

Arranging Hat is a cushy job indeed; high impact work, absolute authority, and 364 days of holiday every year. However, the hat has decided that it can do even better-it would like very much to become a tenured professor. Recently the hat has been re…
Arranging Hat 题目大意: 给你n,m n个m位的数,保证m位,问要是n个按照从小到大排序,求改变最少个数字,使得这n个按照不递增排序,求最后排序的结果. //dp[i][j] 表示前i个数,修改不超过j次的最小值. dp[i][j]向dp[i+1][j+k]转移//pre[i][j]表示第i个数修改j次是由第i-1个数修改pre[i][j]次转移过来的. #include <cstdio> #include <cstring> #include <queue&g…
发现由于角的度数和边的长度有限制,那俩圆如果放得下的话,必然是塞在两个角里. 于是预处理n个圆心的位置(注意要判断那个圆会不会和其他的边界相交),然后n^2枚举俩角即可. #include<cstdio> #include<cmath> using namespace std; #define EPS 0.00000001 struct Point{ double x,y; double length(){ return sqrt(x*x+y*y); } }a[2010]; typ…
那个人派出的队伍的行走的路径一定前半程是重合的,后半程分叉开来. 于是预处理每个点离1号点的最短路,到最近的铁的最短路,到最近的煤的最短路.(三次BFS / SPFA)然后枚举分岔点,尝试更新答案即可. #include<cstdio> #include<queue> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; queue<int>…
二分Vx即可. #include<cstdio> #include<algorithm> using namespace std; #define EPS 0.00000000001 struct RANGE{ int l,r; double f; }rs[110]; bool cmp(const RANGE &a,const RANGE &b){ return a.l<b.l; } int xe,ye,n,Left; bool check(double vx…
有向图,不经过重复点的最长链,强连通分量大小不超过5. 每个强连通分量内部暴力预处理任意两对点之间的最长路,外面DAG上dp. 不是很好写,但是预处理完了之后,可以重构每个强连通分量内部的结构,然后整个就变成一张DAG了,就很方便了. #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <…
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=1247 题目: Hat's Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13765    Accepted Submission(s): 4927 Problem Description A hat's word is…
Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7282    Accepted Submission(s): 2639 Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly…
Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10993    Accepted Submission(s): 3944 Problem Description A hat’s word is a word in the dictionary that is the concatenation of exact…
Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8343    Accepted Submission(s): 3004 Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly…