srm 580 div1
2013-05-27 21:33
267 查看
要答辩,木有时间啊,练习了一下,依旧不给力,只能做出第一个,啥时候第二个能轻易做出来,也就说明我进步了吧~~~
1、离散所有点就可以了
from kakamilan
1、离散所有点就可以了
#include <iostream> #include <string> #include <vector> #include <cstdlib> #include <cmath> #include <map> #include <algorithm> #include <list> #include <ctime> #include <set> #include <string.h> #include <queue> using namespace std; class EelAndRabbit{ public: int cal(vector <int>& l, vector <int>& t,int catchtime,vector<int>& judge){ int sz=l.size(); int ct=0; for(int i=0;i<sz;i++){ if(catchtime>=t[i]&&catchtime<=(t[i]+l[i])&&judge[i]==0){ ct++; judge[i]=1; } } return ct; } int getmax(vector <int> l, vector <int> t){ int sz=l.size(); map<int,int> alltime; for(int i=0;i<sz;i++){ alltime[t[i]]=1; alltime[t[i]+l[i]]=1; } vector<int> rtime; for(map<int,int>::iterator it=alltime.begin();alltime.end()!=it;it++){ int t=it->first; rtime.push_back(t); } int rsz=rtime.size(); int res=0; for(int i=0;i<rsz;i++){ for(int j=i+1;j<rsz;j++){ vector<int> judge(sz,0); int f=cal(l,t,rtime[i],judge); int s=cal(l,t,rtime[j],judge); res=max(res,(f+s)); } } return res; } };
from kakamilan
相关文章推荐
- [TopCoder] SRM580, DIV1, 600p, Solution
- [TopCoder] SRM 580 DIV 2, 250p, 500p, 1000p, Solution
- TOPCODER_SRM580_DIV2_2---------枚举
- SRM 580 250 DIV2
- topcoder srm 580 div1
- [TopCoder] SRM580, DIV1, 600p, Solution
- [TopCoder] SRM 580 DIV 2, 250p, 500p, 1000p, Solution
- TC SRM 400 DIV2
- [TopCoder] SRM 581 DIV 2, 250p, 500p, 1000p, Solution
- TC SRM 659 DIV1 500pt 插头DP
- SRM 553 DIV2
- topcoder srm 390 div1
- 【TopCoder】SRM159 DIV2总结
- topcoder srm 380 div1
- Topcoder SRM 596 DIV 1
- Topcoder SRM 660 DIV1 500 Privateparty(数学)
- SRM 556 DIV2 解题报告
- TopCoder SRM 598 Div1 第1题
- SRM 599 div2 250 500
- Topcoder SRM 683 Div2 B