摘要:
luogu 传送门bfs拓展嘛。 不过这里有一点特别之处,就是记录状态时要三维,f[i][j][0/1],代表到了(i , j)这个点是否使用过向量。 在bfs中往四面走,如果没有使用过向量,就再拓展一下使用向量的。(还是比较容易啦)#include#include#include#... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(113)
评论(0)
推荐(0)
摘要:
luogu 传送门挺好想的贪心(蒟蒻一下就想到啦)。 我们从前往后处理时,尽量吃后面的糖,因为后面的糖会对后面产生影响,而前面的就不会影响了。 不过要开long long ,为此我wa了两个点。#include#include#include#include#include#defi... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(140)
评论(0)
推荐(0)
摘要:
有时候我们对于一个题先写了不确定的貌似是正解的程序,然后又写了保证正确的暴力。 那么我们怎样来确定我们想的正解对不对呢?对拍。 对拍我们需要这样几个文件: data是数据生成器,right是暴力,test是待定正确程序。 举一个a+b的例子,里面是这样写的。data.cpp#incl... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(118)
评论(0)
推荐(0)
摘要:
luogu 传送门 搞了半天,终于搞了出来。 以前写过一个暴力70分的做法(点这里)在70分的基础上: 注意到只有空格在指定棋子旁边才有意义,所以可以O(n^2)记录状态,记录空格在指定棋子的哪个方向。 因为询问数比较多,所以可以预处理出来【指定棋子不动,空格移动到另一边】和【棋子... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(127)
评论(0)
推荐(0)
摘要:
luogu 传送门 双倍经验! 树状数组题 v[i]只有当和比它小的v[j]一起运算时才对答案有贡献。 我们可以这样来处理,离线来做。将所有奶牛按照v升序排序,然后一个奶牛一个奶牛的查询,再插入。 我们要树状数组来维护一个数组cnt[i],和sum[i]表示i-lowbit... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(172)
评论(0)
推荐(0)
摘要:
给出一段序列,选出其中连续且非空的一段使得这段和最大。 注:非空 是dp吧;#include#include#include#include#includeusing namespace std;int a[200010],f[200010];int main(){ int n... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(101)
评论(0)
推荐(0)
摘要:
luogu 传送门 题目描述 给出一个 n 个数的序列,为 A0,A1,„„,An-1,循环移动 k 位之后,这个序列就变 成了 Ak,Ak+1,,,,An-1,A0,A1,,,,Ak-1。一种优秀的循环移动是,对于任意的 前 i(1#include#include#include ... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(192)
评论(0)
推荐(0)
摘要:
luogu 传送门这个题,用O(n)真的可以吗?大概是洛谷数据太弱了。#include#include#include#include #define LL long longusing namespace std;int n;LL ans=1;LL work(LL x){ w... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(97)
评论(0)
推荐(0)
摘要:
水#include#include#includeusing namespace std;int n,ans;char a[109];int main(){ scanf("%d",&n); cin>>a; int s=0; for(int j=0;j<n;j+... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(227)
评论(0)
推荐(0)
摘要:
大大大水题。#include#include#includeusing namespace std;int n;char a[100];int main(){ scanf("%d",&n); for(int i=1;i>a; int x=a[strlen(a... 阅读全文
posted @ 2017-09-24 17:48
primes
阅读(105)
评论(0)
推荐(0)

浙公网安备 33010602011771号