摘要: 之前也想到了利用前缀数组,记录每一位的0~i的值,但是这样效率并不高。 题解的方法是每出现一次这个数字,记录一下下标,然后通过求区间的交,这样优化就不会超时了。 阅读全文
posted @ 2017-07-30 17:29 爱种树的码农 阅读(196) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #define ll long long #define pb push_back #define max(x,y) ((x)>(y)?(x):(y)) #define min(x,y) ((x)>(... 阅读全文
posted @ 2017-07-30 14:46 爱种树的码农 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Balala Power! Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3594 Accepted Submission(s): 855 阅读全文
posted @ 2017-07-26 16:11 爱种树的码农 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 树形dp并不擅长,还是步履蹒跚的写出来了,dp[i][j][k],i代表编号为i的点,j为0和1分别代表两种颜色,k为0代表这个点为孤立点,k为1代表这个点为非孤立点。 以一种颜色为例: 1.当这个点为孤立点,它的子节点颜色必定是不同的,若子节点也为孤立点,那么这个子节点永远都不可能变为非孤立点,所 阅读全文
posted @ 2017-07-24 18:08 爱种树的码农 阅读(329) 评论(0) 推荐(0) 编辑
摘要: E. Minimal Labels time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output E. Minimal Labels time 阅读全文
posted @ 2017-07-18 15:11 爱种树的码农 阅读(230) 评论(0) 推荐(0) 编辑
摘要: E - Awkward Response Time limit : 2sec / Memory limit : 256MB Score : 800 points Problem Statement This is an interactive task. Snuke has a favorite p 阅读全文
posted @ 2017-07-16 10:51 爱种树的码农 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 丢史蒂芬妮 发布时间: 2017年7月9日 18:17 最后更新: 2017年7月9日 21:05 时间限制: 1000ms 内存限制: 128M 描述 有一天,空和白很无聊,决定玩盛大游戏,考虑到两个人玩,他们随便掏了一个游戏出来:在一个n∗m 的棋盘上,首先把史蒂芬妮·多拉放在左上角(1,1) 阅读全文
posted @ 2017-07-14 20:56 爱种树的码农 阅读(219) 评论(0) 推荐(0) 编辑
摘要: C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp watched TV-show w 阅读全文
posted @ 2017-07-14 08:55 爱种树的码农 阅读(216) 评论(0) 推荐(0) 编辑
摘要: D. High Load time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output D. High Load time limit per 阅读全文
posted @ 2017-07-13 15:26 爱种树的码农 阅读(118) 评论(0) 推荐(0) 编辑
摘要: A序列 发布时间: 2017年7月9日 18:17 最后更新: 2017年7月9日 21:05 时间限制: 1000ms 内存限制: 128M 描述 如果一个序列有奇数个正整数组成,不妨令此序列为a 1 ,a 2 ,a 3 ,...,a 2∗k+1 (0<=k ),并且a 1 ,a 2 ...a k 阅读全文
posted @ 2017-07-10 10:05 爱种树的码农 阅读(305) 评论(0) 推荐(0) 编辑