
离散
文章平均质量分 58
Saito Asuka
这个作者很懒,什么都没留下…
展开
-
CodeForces - 977F - Consecutive Subsequence 动态规划+离散化
F. Consecutive Subsequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer array of length n.You have to choose some subse...原创 2018-05-07 20:12:28 · 244 阅读 · 0 评论 -
HDU - 5542 The Battle of Chibi 离散化+dp+树状数组
题目链接题意:给出一个长为n的序列,求其中长为m的严格单调上升序列的个数。思路:dp[i][j],表示以i为结尾长为j的序列的个数。由于i最大有1e9,所以离散化,这样i最大就只有1000。那么状态转移方程为: 这样时间复杂度就有,对于转移方程里的区间求和,可以通过树状数组维护(线段树空间不够),这样复杂度就到了。#include<cstdio>#inclu...原创 2018-11-11 15:53:09 · 216 阅读 · 0 评论 -
HDU - 6534 Chika and Friendly Pairs 莫队+树状数组+离散化
题目链接题意:一个长度为 nnn 的序列,现在有 mmm 个提问,每个提问包括一个区间 [l,r][l,r][l,r],询问该区间内有多少对 (ai,aj)(i<j)(a_i,a_j)(i<j)(ai,aj)(i<j) 满足 ∣ai−aj∣<=K|a_i - a_j| <= K∣ai−aj∣<=K思路:由于 KKK 值...原创 2019-06-30 22:55:12 · 312 阅读 · 0 评论