Codeforces Round #138 (Div. 2)
A. Parallelepiped
- 枚举其中一边,计算其他两条边。
B. Array
- 模拟。
C. Bracket Sequence
- 栈。
D. Two Strings
- \(pre[i]\)表示第i个参与匹配的最长前缀。
- \(suf[i]\)表示\([i,n]\)能匹配的最大后缀,可以不包括位置i。
- 如果存在\(pre[i]==0\ or\ pre[i]+suf[i+1]<m\),说明位置i不能够拼成串\(t\)。
- \(pre[i]\):如果\(i\)匹配了长度\(pre[i]\),那么所有位置\(j \gt i\)且字符为\(t[pre[i]+1]\)的匹配长度至少为\(pre[i]+1\),那么可以用线段树维护区间最值即可。
- 上述做法是比较麻烦的,用\(p[i][j]\)表示距离\(i\)最近的字符\(j\)的位置,可以比较方便地求,空间复杂度比较大就是。
E. Partial Sums
- 单独考虑每个数在每个位置的贡献即可,出现的次数为组合数。
Codeforces Round #138 (Div. 2)的更多相关文章
- Codeforces Round #138 (Div. 2) ACBDE
A.Parallelepiped 题意:给一个六面体三面的面积,求12条边的长度和. 题解:因为都是整数,设边长分别为a,b,c,面积为xyz,那么可设x=a*b,y=b*c,z=c*a,简单解方程就 ...
- Codeforces Round #138 (Div. 2) A. Parallelepiped
A. Parallelepiped time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Codeforces Round #138 (Div. 1)
A 记得以前做过 当时好像没做对 就是找个子串 满足括号的匹配 []最多的 开两个栈模拟 标记下就行 #include <iostream> #include<cstring> ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
随机推荐
- 如何在windows上搭建ftp服务器
FTP(File Transfer Protocol)是TCP/IP网络上两台计算机传送文件的协议,使得主机间可以共享文件.目前有很多软件都能实现这一功能,然而windows自带的IIS就可以帮助你搭 ...
- [转]理解WSRF之一 使用WS-ResourceProperties (整理自IBM网站)
理解 WSRF第1部分-使用 WS-ResourceProperties 本 教程是一个由 4 部分组成的系列文章中的第 1 部分,该系列介绍 WSRF(Web Services Resource ...
- <select>标签使用方法
前台页面: <form id="form1" runat="server"> <select runat="server" ...
- Bootstrap非常简单实用的web前端开发框架
今天无意间用firebug看网站的代码发现了Bootstrap,之前从来没有听说过这个东东,于是对它产生了好奇感,通过百度我了解到了Bootstrap是一款非常简单,强悍,实用,移动设备端优先使用的这 ...
- 苹果 Mac OS X Yosemite 10.10 新功能特性总结 - 扁平化、主打跨设备的无缝连通性
苹果在2014.06.03凌晨的 WWDC 2014 大会上正式发布了最新的 OS X Yosemite 桌面操作系统和 iOS 8 移动系统.虽然整场发布会的重心都在软件上,并没有硬件亮相,但软件上 ...
- 一个完整的ansible实施目录示例
当前目录:
- poj1160 dp
//Accepted 564 KB 63 ms //和hdu1227一样 //dp[i][j]=min(dp[i][j],dp[k][j-1]+cost[k+1][i]) //初始化条件,dp[0][ ...
- declare 关键字在Oracle中的应用。
一般用在trigger或匿名存储过程中使用.如 declare a number;begina:=1;end;
- hdu 2068
ps:长度长到我不想说....WA了无数次...25的阶乘就爆炸... 代码: #include "stdio.h" #define LL long long LL fac(lon ...
- The ShortCuts in the ADT (to be continued)
1. automatically add all the namespace which need to be include in the class. ctrl+shift+o