BestCoder Round #92 (hdu 6015 6016)】的更多相关文章

比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long long LL; LL T,n; map<string,int> mp1,mp2; int main() { cin>>T; while(T--) { mp1.clear();mp2.clear(); cin>>n; ;i<n;i++) { string str; in…
BestCoder Sequence Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, an amazing sequence appeared in his dream. Length of this sequence is odd, the median number is M, and he named this sequence as Bestcoder Sequence. A…
Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 354    Accepted Submission(s): 100 Problem Description ZYB has a tree with N nodes,now he wants you to solve the numbers of nodes distanced no m…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 175    Accepted Submission(s): 74 Problem Description ZYB has a premutation P,but he only remeber the reverse log of each prefix of the premutat…
Task schedule Problem Description 有一台机器,而且给你这台机器的工作表.工作表上有n个任务,机器在ti时间运行第i个任务,1秒就可以完毕1个任务. 有m个询问,每一个询问有一个数字q.表示假设在q时间有一个工作表之外的任务请求,请计算何时这个任务才干被运行. 机器总是依照工作表运行,当机器空暇时马上运行工作表之外的任务请求.   Input 输入的第一行包括一个整数T, 表示一共同拥有T组測试数据. 对于每组測试数据: 第一行是两个数字n, m,表示工作表里面有…
比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long long LL; LL T,n; map<string,int> mp1,mp2; int main() { cin>>T; while(T--) { mp1.clear();mp2.clear(); cin>>n; ;i<n;i++) { string str; in…
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关键是如何将科目与分数进行对应,即如果将字符串与数字对应.由于之前解除了字典树,所以就想到用字典树存储单词,并为每种编上编号,之后就用这个编号与分数对应. 就个人观点而言,a[][]数组应该不用清零,因为下个case会将之前的case覆盖掉,但是错了,也找不出原因.所以以后为了安全起见,不管是否会被覆盖,都清…
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1002 题解: 做题的时候只是想到用dfs暴搜,结果超时了.(刚学dfs时以为它无所不能,后来渐渐不太喜欢了,因为太暴力了,经常超时) TLE wa代码如下: #include<bits/stdc++.h> using namespace std; vector<int>v0[100005],v1[100005]; i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6016 题意:给定男羊和女羊的朋友关系,即给定一个图,问从任意一只羊开始连续数四只不相同的羊的方法数. 思路:一开始用了dfs没过,报的超时,以为真的会超时,最后发现,犯了个以前常犯的老问题,存边的vector开小了,,这道题需要开 (n+m)的vector. 后来又按官方题解做了一遍,官方题解,也就需要脑袋转一下.要找序列:男--女--男--女,或者 女--男--女--男:那么只需要找其中一种,即只…
上午考完试后看到了晚上的BestCoder比赛,全机房都来参加 感觉压力好大啊QAQ,要被虐了. 7:00 比赛开始了,迅速点进了T1 大呼这好水啊!告诉了同桌怎么看中文题面 然后就开始码码码,4分16秒AC了第一题 7:05 开始看第二题 诶诶诶!!~~~~直接爆搜不久能过吗? 交了一发爆搜上去,AC了,心里默默地说:这也**能过 然后去刷Clarification,看到了里面的温馨提示... 我去!敢情我只过了小数据!!!! 7:18 赶紧滚回去改题,T1的竞速题就不说了 T2爆搜明显超时啊…