- 博客(9)
- 收藏
- 关注
原创 bzoj3732Network 整体二分
这道题用整体二分就可以做了 但是整体二分不能用递归 每一层整体二分都要重建一遍边 复杂度O(klog(k)log(n))#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;inline int read(){ int x=0,f=1,ch=
2017-04-02 14:52:20
480
原创 bzoj4807車
毫无疑问,如果把n行看做一行的话 就相当于在m个位置中取n个 答案就是C(m,n)了 套一发高精度就行了#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;inline int read(){ int x=0,f=1,ch=getchar(
2017-04-02 09:37:09
725
原创 bzoj4806 炮
这道题其实是同bzoj1801的, 只是模数不同 用dp[i][j][k]表示第i行有j列有没有子,k列一个子 再枚举一下是从那列转移来的就行了#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int mod=999983;inlin
2017-04-01 17:34:11
849
原创 bzoj4809皇后
虽然数据范围看着很大 但是一个普通的搜索就可以过了 不清楚的可以研究一下8皇后怎么写#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;inline int read(){ int x=0,f=1,ch=getchar(); while(ch
2017-04-01 14:25:11
605
原创 秦皇岛三日游
学了一年oi,第二次去参加noip 考试一直懵逼,勉强不用afo,就被神犇们虐爆了 回来后,神犇们都开始自己搭blog了 只有我这种蒟蒻还在用牛(垃)逼(圾)csdn
2016-11-30 21:52:03
790
原创 bzoj1399 WIN
一道dp题 一棵赛程树是一棵以m为根的满二叉树 dp[i][s][h] 三位状态中 i表示这棵子树的根为i s表示这棵子树中含有的节点状态 h表示这棵子树的高度 dp[i][s][h]=∑dp[j][s’][h-1]*dp[i][s-s’][h-1]#include<cstdio>#include<cstring>#include<iostream>#include<algori
2016-10-13 14:17:36
472
原创 bzoj2124 等差子序列【暴力】
题意自己看 /* 正解是hash+树状数组 但我太蒟蒻了 不会写 只好写暴力了 */ 维护一个0,1字符串 0表示这个字符在左边 1表示不再左边 枚举两边是否有(0,1)对称分布 虽然复杂度超了 但的确能过(数据水)#include<cstdio>#include<cstring>#include<iostream>using namespace std;int n;
2016-09-20 21:50:54
770
1
原创 tyvj1340送礼物 折半枚举
一道折半枚举 n<=45 分成两半 一半23一半22 再枚举枚举每一半的东西选或者是不选(复杂度O2^(n/2)) 然而有几个优化是需要的 首先要通过dfs查找需要什么,因为很多的状态是多余的 接着找出后要进行排序(两边都需要) 再用一个id表明当前的位置 就可以做到O(n)的查找了#include<cstdio>#include<cstring>#include<iostr
2016-09-11 15:11:36
708
原创 bzoj3827:[Poi2014]Around the world
首先枚举d(复杂度是O(s))。 接着计算从每一点出发在当前d的情况下最远可以到达那个点(复杂度为O(n))。 最后这些就形成了一棵以2*n为根的树(因为每个点只有一个指向的节点)。 最后在用并查集维护就行了。 总的复杂度是O(n*s)的。 但是这道题疯狂卡常和卡内存。(我这种蒟蒻就MLE和TLE了无数次) 详细看代码。#include<cstdio>#include<cstring>
2016-08-27 16:22:43
899
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人