上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 44 下一页
摘要: 题目链接judge函数没写好,直接暴力就可以水过去。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 char str[21][31];10 int p[21][21];11 int len[21];12 int o[21],minz,n;13 int judge(int x,int y)14 {15 int len1,len2,i,j,k,ans,minz,flag;16 len1 = strlen(str[... 阅读全文
posted @ 2013-07-06 14:27 Naix_x 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 好久没写过CF的博客了,最近忙着考试,各种不顺,没想到这次CF却是很顺利。A题暴力,开始看错题了。。然后发现只需要转一次。。。B题也是暴力去构造的,C题一个组合问题,话说这次终于在比赛里把组合题给A了,这题不难,但也不是很水,当时就是觉得应该是这样,感觉题意也不是很清楚,按自己的理解过了样例,应该就没问题了,用到以前用过的等比数列求和取余的模版。D题也是构造问题,只要看出一个连通块,只要一个100塔其他都是200塔就行了。DIV2里,第一次做了4个题。。rating涨了181。。如果我之前的rating 是蓝色,而不是绿色的话,这次就可以变紫了把。。。以后还有机会,慢慢来把。A题 1 #inc 阅读全文
posted @ 2013-07-05 09:44 Naix_x 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目链接非常不容易的一道题,把每个点向右上构造一个矩形,将问题转化为重合矩形那个亮度最大,注意LL,注意排序。 1 #include <cstdio> 2 #include <cstring> 3 #include <string> 4 #include <algorithm> 5 using namespace std; 6 #define maxn 50100 7 #define lson l,m,rt<<1 8 #define rson m+1,r,rt<<1|1 9 #define LL __int64 10 st 阅读全文
posted @ 2013-06-20 20:42 Naix_x 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题目链接虽然是看的别的人思路,但是做出来还是挺高兴的。首先求环上最大字段和,而且不能是含有全部元素。本来我的想法是n个元素变为2*n个元素那样做的,这样并不好弄。实际可以求出最小值,总和-最小,就可以求出,断开的情况了。然后线段树要单点更新,这种标记,以前遇到过,不过一直没有写过,注意总和好更新,整个这一段的结果也很好更新,最难想的就是左边 和右边标记的结果,具体看pushup代码。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 阅读全文
posted @ 2013-06-19 16:19 Naix_x 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 做了俩,rating涨了80。第二个题是关于身份证的模拟题,写的时间比较长,但是我认真检查了。。。第三个题是最短路,今天写了写,写的很繁琐,写的很多错。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 #include <queue> 8 using namespace std; 9 #define INF 阅读全文
posted @ 2013-06-19 10:43 Naix_x 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 题目链接二分求上界和下界,树状数组。注意特殊情况。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 int p[100001]; 9 int o[100001]; 10 int stack[100001]; 11 int n; 12 int lowbit(int t) 13 阅读全文
posted @ 2013-06-18 15:07 Naix_x 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 题目链接注意题目中给的顺序是顺时针的,所以在数组中应该是倒着存的。左就是顺时针,右就是逆时针。各种调试之后,终于A了,很多种情况考虑情况。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 char name[500001][11]; 9 int o[500001]; 10 阅读全文
posted @ 2013-06-18 09:27 Naix_x 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 题目链接居然没更新flag就交了,错了两次。。3个题,都是一个类型。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 int o[5001]; 9 int flag[5001];10 int find(int x)11 {12 if(x == o[x]) return x; 阅读全文
posted @ 2013-06-17 19:21 Naix_x 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 题目链接经过宝哥的讲解,终于对这种问题有了进一步的理解。根据flag[x]和flag[y]求flag[tx]是最关键的了。0吃1,1吃2,2吃0.假设flag[tx] = X;那么X + flag[x] = flag[y] + 2 (当x吃y的时候) 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using name 阅读全文
posted @ 2013-06-17 17:01 Naix_x 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 题目链接这种类型的题目以前见过,今天第一次写,具体过程,还要慢慢理解。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 int o[100001]; 9 int flag[100001];10 int find(int x)11 {12 if (x == o[x]) ret 阅读全文
posted @ 2013-06-17 14:33 Naix_x 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Rating又跌了,第二个题,没想好就乱开始乱写了。。我写乱搞贪心,没过。。。如果总人数很多judge函数写的不好,DIV2数据很水,直接暴力就行。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 using namespace std; 8 vector<int>::iterator it; 9 int 阅读全文
posted @ 2013-06-16 21:03 Naix_x 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 题目链接找到最小的约数最多的。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define LL __int64 6 LL ans,res,n; 7 int prime[16] = {1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}; 8 //当前枚举到的数;枚举到的第K大的质因子;该数的约数个数;质因子个数上限。 9 void dfs(LL num,LL k,LL sum,int lim 阅读全文
posted @ 2013-06-05 20:05 Naix_x 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接非常无语的一个题,参考的HH大神的代码。离散化写的很神。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 #define lson l , m ,rt<<1 6 #define rson m + 1, r, rt<<1|1 7 8 const int maxn = 21111; 9 int cnt; 10 bool hash[maxn]; 11 int x[maxn+30],y[maxn+30]; 阅读全文
posted @ 2013-06-04 21:37 Naix_x 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目链接看了别人思路,逆序插入,然后就会发现只要为留出pos[i]个位置就行了。树状数组+二分求下界就好了。 1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 #include <iostream> 5 using namespace std; 6 #define N 200011 7 int pos[N]; 8 int p[N],n; 9 struct node10 {11 int val;12 int id;13 }num[N];14 int lowbit( 阅读全文
posted @ 2013-06-03 16:06 Naix_x 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 题目链接根据区间更新的模版改改。线段树真的很不熟悉,交了很多次。 1 #include <stdio.h> 2 #include <string.h> 3 #include <iostream> 4 using namespace std; 5 #define N 100001 6 #define LL __int64 7 int p[4*N],lz[4*N]; 8 void pushup(int rt) 9 {10 p[rt] = p[rt<<1]|p[rt<<1|1];11 }12 void pushdown(int rt)13 阅读全文
posted @ 2013-06-03 10:38 Naix_x 阅读(166) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 44 下一页