E. Okabe and El Psy Kongroo time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to k…
E. Okabe and El Psy Kongroo     Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points…
E. Okabe and El Psy Kongroo   Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points (…
LINK 题意:给出$n$条平行于x轴的线段,终点$k$坐标$(k <= 10^{18})$,现在可以在线段之间进行移动,但不能超出两条线段的y坐标所夹范围,问到达终点有几种方案. 思路:刚开始以为限制只是到达线段上就必须沿线段走,后来才发现是要求走y坐标所夹范围,那么就简单多了,很容易看出是个递推形DP,然而数据量有点大,k为10的18次,一般转移显然不可行.由于是个递推,而且y坐标最大也只有15,故使用矩阵优化递推复杂度即可. /** @Date : 2017-07-04 16:06:18…
题目地址:http://codeforces.com/contest/551/problem/D 分析下公式能够知道,相当于每一位上放0或者1使得最后成为0或者1.假设最后是0的话,那么全部相邻位一定不能全是1,由于假设有一对相邻位全为1,那么这两个的AND值为1.又由于OR值是仅仅要有1.结果就为1.所以这位结果肯定为1.所以就推出了一个dp转移方程.dp[i][j]表示第i位上的数为j时的总个数.那么有: dp[i][0]=dp[i-1][0]+dp[i-1][1]; dp[i][1]=dp…
C - Kalila and Dimna in the Logging Industry 很容易能得到状态转移方程 dp[ i ] = min( dp[ j ] + b[ j ] * a[ i ] ), 然后斜率优化一下. 一直以为炸精度了, 忽然发现手贱把while 写成了if .... #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #d…
D. GukiZ and Binary Operations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We all know that GukiZ often plays with arrays. Now he is thinking about this problem: how many arrays a, of l…
/****************************************************************************************************************** 因为发现不敲题会变蠢...所以没事还是做两道题吧.... 很久没做过题然后发现C和E全都是因为没用LL给卡住了......  我真的是太蠢了 ***************************************************************…
本来打算划划水洗洗睡了,突然听到这次的主人公是冈部伦太郎 石头门(<steins;gate>)主题的比赛,岂有不打之理! 石头门真的很棒啊!人设也好剧情也赞曲子也特别好听. 推荐http://music.163.com/#/m/song?id=26259014&userid=115264555 (强行跑题) Okabe and Future Gadget Laboratory O(n^4)暴力妥妥的 #include<iostream> #include<algori…
E. Okabe and El Psy Kongroo time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to k…