貌似和以前做过的某道题一模一样,离线查询在这里http://www.cnblogs.com/wuyiqi/archive/2012/02/13/2349290.htmlView Code #include<cstdio>#include<cstring>#include<map>#include<algorithm>using namespace std;const int maxn = 50010;__int64 c[maxn];struct node{ int l,r,id;}p[200010];map<int,int> Hash Read More
posted @ 2012-05-17 17:06
Because Of You
Views(233)
Comments(0)
Diggs(0)
此题有一个关键的地方决定了可以使用树状数组来搞:所有询问的区间不相互包含,但可能交叉这样就可以从左往右边添加边删除用树状数组来做了如果存在包含关系,就不能用树状数组搞了,原因的话看看poj 2104的样例数据就明白了View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 100010;struct node{ int key,id; bool operator < (const node & cm)con Read More
posted @ 2012-05-17 16:59
Because Of You
Views(794)
Comments(0)
Diggs(0)
A 给你一个环,环上的每条边都有一个方向,按某个方向(顺时针或逆时针)走一遍,把与行走的方向相反的边反向,并加上相应的费用,判断走哪个方向的费用比较少直接dfs搞即可View Code #include<cstdio>#include<cstring>#include<vector>#include<algorithm>using namespace std;int out[110];vector<int> edge[110];int flag[110][110];int mm[110][110];int vis[110];vecto Read More
posted @ 2012-05-17 05:51
Because Of You
Views(389)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号