上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 44 下一页
摘要: 3维树状数组,将单点更新转变为区间更新。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 #define LL __int64 7 #define N 50002 8 int p[11][11][50011]; 9 int num[50011];10 int n;11 int lowbit(int t)12 {13 return t&(-t);14 }15 void ins 阅读全文
posted @ 2013-05-31 16:05 Naix_x 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目链接离线算法,以前做过一个,非常神奇。先把所有的区间,按Y排序,再按X排,然后算每一个区间,如果遇到了相同的就把前一个点更新一下-num[le],当前点插入。如果相同直接插入。再区间求和,记录结果。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 #define N 200001 7 #define LL __int64 8 struct node 9 {10 int x,y, 阅读全文
posted @ 2013-05-30 20:26 Naix_x 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题目链接每一个必胜点P,肯定可以走到一个N点,N点的下一步,全是P点。递推出小数据,找规律,很明显。 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 using namespace std; 5 int dp[101][101]; 6 char s1[10001],s2[10001]; 7 int main() 8 { 9 // int i,j,k,z,n,m;10 // memset(dp,-1,sizeof(dp));11 // for(i = 1;i <= 100; 阅读全文
posted @ 2013-05-30 10:21 Naix_x 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 好久没写了,单调队列。 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 using namespace std; 5 int dp[2000001],p[2000001],sum[2000001]; 6 int que[2000001]; 7 int main() 8 { 9 int n,m,i,str,end;10 scanf("%d%d",&n,&m);11 for(i = 1;i <= n;i ++)12 {13 scanf(&q 阅读全文
posted @ 2013-05-30 09:23 Naix_x 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 题目链接模版题,写错了,wa好几次。。 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 using namespace std; 5 #define LL __int64 6 int dp[1001]; 7 int fib[21]; 8 int sg(int x) 9 {10 int flag[101],temp,i;11 if(dp[x] >= 0)12 return dp[x];13 memset(flag,0,sizeof(flag));14 for(i = 1;i 阅读全文
posted @ 2013-05-29 15:20 Naix_x 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 先暴力出sg函数来,会发现sg(x) = x,然后枚举每一种走法,看看异或结果是否为0。因为temp^temp = 0,所以这样可以直接判断。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 int n; 7 int p[101]; 8 int main() 9 {10 int i,temp,ans,num;11 while(scanf("%d",& 阅读全文
posted @ 2013-05-28 20:55 Naix_x 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 这个题和传纸条差不多,但是我没想到。。还是在解决只走一次时候,没想到怎么办。dp[i][j]代表一条走到i和另一条走到j的最多结点。假如某点走了两次那么他一定是从dp[i][i]走来的,但是dp[i][i] = 0,所以根本没有这种情况。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: tour 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <algorithm>10 #include <map> 阅读全文
posted @ 2013-05-28 19:54 Naix_x 阅读(237) 评论(0) 推荐(0) 编辑
摘要: SG函数模版,学习ing... 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 int dp[10001],n; 7 int p[101]; 8 int sg(int x) 9 {10 int i;11 int flag[101];12 memset(flag,0,sizeof(flag));13 if(dp[x] != -1)14 return dp[x];15 if(x 阅读全文
posted @ 2013-05-28 10:36 Naix_x 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 打表水过。看的题解,置换的那个优化完全没有看懂。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: latin 5 */ 6 #include <cstdio> 7 #include <iostream> 8 using namespace std; 9 int r[11][11],c[11][11];10 int ans,n;11 void dfs(int x,int y)12 {13 int xx,yy,i;14 if(x > n-1)15 {16 ans ++;17 return ;18 }19 ... 阅读全文
posted @ 2013-05-28 08:46 Naix_x 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 最大子矩阵问题,USACO上貌似好几个把。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: bigbrn 5 */ 6 #include <iostream> 7 #include <cstring> 8 #include <cstdio> 9 #include <cstdlib>10 using namespace std;11 int dp[1001][1001],r[1001][1001],c[1001][1001];12 bool o[1001][1001];13 int main()14 {15 int n 阅读全文
posted @ 2013-05-27 18:15 Naix_x 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 我以前的Tarjan模版,全都敲错了。。。一个v写成了u,而且都AC了。。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: schlnet 5 */ 6 #include <iostream> 7 #include <cstring> 8 #include <cstdio> 9 #include <cstdlib> 10 using namespace std; 11 #define N 10001 12 #define M 500001 13 struct node 14 { 15 int u,v,next; 16 阅读全文
posted @ 2013-05-27 16:26 Naix_x 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 坐标不全是左上角,右下角的。2Y,怎么可以写的这么麻烦。。。暴力水过。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: window 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <cmath> 10 #include <algorithm> 11 #include <vector> 12 #include <string> 13 #include <queue> 阅读全文
posted @ 2013-05-27 10:47 Naix_x 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 理解错题意了。。。写的很麻烦,而且900+卡过。。。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #include <string> 6 #include <cmath> 7 using namespace std; 8 #define eps 1e-6 9 struct cir 10 { 11 int x,y,r; 12 } p[1001]; 13 int flag[1001]; 14 in 阅读全文
posted @ 2013-05-25 22:21 Naix_x 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 像是背包的逆问题,给一个体积,然后给一些物品,求用最少的物品组成这个体积,输出字典序最小的集合。物品和体积都不小,完全没什么思路,印象中DD大神的背包9讲里,有USACO里背包问题的解析,然后发现暴力然后DP就可以过,然后。。。就水过了。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: milk4 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <cmath> 9 #include <algorithm>10 #include <iostream 阅读全文
posted @ 2013-05-24 09:37 Naix_x 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 好扯淡。。。 1 /* 2 ID: cuizhe 3 LANG: C++ 4 TASK: wissqu 5 */ 6 #include <iostream> 7 #include <cstdio> 8 #include <cstring> 9 #include <queue> 10 #include <map> 11 #include <ctime> 12 #include <cmath> 13 #include <algorithm> 14 using namespace std; 15 char 阅读全文
posted @ 2013-05-23 09:47 Naix_x 阅读(198) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 44 下一页