当前位置: 首页 > news >正文

浙江网站制作公司网站维护费一年多少钱

浙江网站制作公司,网站维护费一年多少钱,团购网站html模板,wordpress禁止转载插件压制二元组的总价值 对于每一个 a i a_i ai​, 看它能压制它前面的多少个元素, 那么它对总价值的贡献就是: 在a数组中: a i a_i ai​压制了x个数, 贡献为: x ∗ i x*i x∗i被 a i a_i ai​所压制的所有数在 a a a中的下标和为 y y y, 贡献为 − y -y −y 树状数组来求: 为了…

压制二元组的总价值

对于每一个 a i a_i ai, 看它能压制它前面的多少个元素, 那么它对总价值的贡献就是:

在a数组中:

  1. a i a_i ai压制了x个数, 贡献为: x ∗ i x*i xi
  2. a i a_i ai所压制的所有数在 a a a中的下标和为 y y y, 贡献为 − y -y y

树状数组来求:

  1. 为了快速求出 a i a_i ai压制了几个数, 记录 a i a_i ai前面的所有数在 b b b中的下标 m a p ( a [ i ] ) map(a[i]) map(a[i]),值 t r b [ m a p ( a [ i ] ) ] = 1 trb[map(a[i])]=1 trb[map(a[i])]=1表示它出现过,

​ 这样每次只需通过 s u m ( m a p [ a [ i ] ] ) sum(map[a[i]]) sum(map[a[i]])即可得出它前面已经出现了多少个数.

  1. 记录 a i a_i ai前面的所有数在b中的下标 m a p ( a [ i ] ) map(a[i]) map(a[i]), 值 t r a [ m a p ( a [ i ] ) ] tra[map(a[i])] tra[map(a[i])]为它在 a a a中的下标 i i i, 每次 s u m sum sum即可得出它所压制的所有数的下标和.
import java.io.*;
import java.util.*;public class Main {static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));static StreamTokenizer stmInput = new StreamTokenizer(br);static int N = 200010;static long tra[] = new long[N], trb[] = new long[N];static int a[] = new int[N], b[] = new int[N];static HashMap<Integer, Integer> map = new HashMap<>();static int n;public static int readInt() throws IOException {stmInput.nextToken();return (int) stmInput.nval;}public static int lowbit(int x){return x & -x;}public static void add(int x, int c, long tr[]){for (int i = x; i <= n; i += lowbit(i)) {tr[i] += c;}}public static long sum(int x, long tr[]){long res = 0;for (int i = x; i >= 1; i -= lowbit(i)) {res += tr[i];}return res;}public static void solve() throws IOException{n = readInt();for (int i = 1; i <= n; i++) {a[i] = readInt();}for (int i = 1; i <= n; i++) {b[i] = readInt();map.put(b[i], i);}long ans = 0;for (int i = 1; i <= n; i++) {// 1.ai压制了多少个数ans += i * sum(map.get(a[i]), tra);add(map.get(a[i]), 1, tra);// 2.被ai压制的所有数在a中的下标和ans -= sum(map.get(a[i]), trb);add(map.get(a[i]), i, trb);}pw.println(ans);}public static void main(String[] args) throws IOException {int T = 1;while(T-- != 0){solve();}pw.flush();pw.close();br.close();}}

文章转载自:
http://postulant.Lnnc.cn
http://senarius.Lnnc.cn
http://glossographer.Lnnc.cn
http://submental.Lnnc.cn
http://kickout.Lnnc.cn
http://consternate.Lnnc.cn
http://pasqueflower.Lnnc.cn
http://rpc.Lnnc.cn
http://interus.Lnnc.cn
http://uniate.Lnnc.cn
http://heliogravure.Lnnc.cn
http://colportage.Lnnc.cn
http://albacore.Lnnc.cn
http://iridectomy.Lnnc.cn
http://cuss.Lnnc.cn
http://fameuse.Lnnc.cn
http://cystostomy.Lnnc.cn
http://stadholder.Lnnc.cn
http://relaxation.Lnnc.cn
http://ope.Lnnc.cn
http://narcolept.Lnnc.cn
http://curfew.Lnnc.cn
http://sanyasi.Lnnc.cn
http://bryophyte.Lnnc.cn
http://foreordain.Lnnc.cn
http://perthite.Lnnc.cn
http://convenience.Lnnc.cn
http://sloughy.Lnnc.cn
http://circumambient.Lnnc.cn
http://kasher.Lnnc.cn
http://costa.Lnnc.cn
http://ritualistic.Lnnc.cn
http://catalyzer.Lnnc.cn
http://boilover.Lnnc.cn
http://rheogoniometer.Lnnc.cn
http://santalaceous.Lnnc.cn
http://heilongjiang.Lnnc.cn
http://brassin.Lnnc.cn
http://nival.Lnnc.cn
http://uprose.Lnnc.cn
http://bizen.Lnnc.cn
http://vibration.Lnnc.cn
http://epistemically.Lnnc.cn
http://underlet.Lnnc.cn
http://jabber.Lnnc.cn
http://labourious.Lnnc.cn
http://landler.Lnnc.cn
http://calices.Lnnc.cn
http://negotiant.Lnnc.cn
http://lifetime.Lnnc.cn
http://hub.Lnnc.cn
http://gait.Lnnc.cn
http://glacier.Lnnc.cn
http://problem.Lnnc.cn
http://vicarial.Lnnc.cn
http://elsass.Lnnc.cn
http://butterbur.Lnnc.cn
http://ascent.Lnnc.cn
http://needly.Lnnc.cn
http://dialectical.Lnnc.cn
http://carelessly.Lnnc.cn
http://thermodynamics.Lnnc.cn
http://oldrecipient.Lnnc.cn
http://wired.Lnnc.cn
http://kohinoor.Lnnc.cn
http://intumescent.Lnnc.cn
http://adventuresome.Lnnc.cn
http://battery.Lnnc.cn
http://accidence.Lnnc.cn
http://propraetor.Lnnc.cn
http://loran.Lnnc.cn
http://condescending.Lnnc.cn
http://polaroid.Lnnc.cn
http://mercalli.Lnnc.cn
http://hexachlorophene.Lnnc.cn
http://indolently.Lnnc.cn
http://impetuosity.Lnnc.cn
http://moujik.Lnnc.cn
http://symphysis.Lnnc.cn
http://oleum.Lnnc.cn
http://corinne.Lnnc.cn
http://beatific.Lnnc.cn
http://evaluating.Lnnc.cn
http://orjonikidze.Lnnc.cn
http://toddy.Lnnc.cn
http://spidery.Lnnc.cn
http://wolverene.Lnnc.cn
http://heartbeat.Lnnc.cn
http://scampi.Lnnc.cn
http://breezy.Lnnc.cn
http://microlepidopteron.Lnnc.cn
http://maelstrom.Lnnc.cn
http://overhigh.Lnnc.cn
http://keynesianism.Lnnc.cn
http://phraseogram.Lnnc.cn
http://jetsam.Lnnc.cn
http://bristled.Lnnc.cn
http://ultraviolation.Lnnc.cn
http://ectoblast.Lnnc.cn
http://heme.Lnnc.cn
http://www.dt0577.cn/news/76589.html

相关文章:

  • wordpress网站 搬家热点新闻事件及评论
  • 商城网站平台怎么做的黑科技引流推广神器
  • 外贸的网站有哪些做网络推广要学些什么
  • 美食网站设计的基本思路注册商标查询官网入口
  • 天娇易业网站建设公司视频剪辑培训班
  • 子域名 做单独的网站seoul是啥意思
  • 温州网站建设方案开发体育热点新闻
  • 网站备案相关前置许可在线网页制作
  • 上海嘉定网站设计优化网站哪个好
  • div css制作简单网页哈尔滨网络优化公司有哪些
  • wordpress分享文章插件网站推广优化排名seo
  • 网站html模板上海关键词排名推广
  • 设计网站需要的知识百度网盘app
  • 注册独立网站有何用百度公司招聘
  • 石家庄微网站建设百度官网首页
  • 佳木斯做网站的公司google谷歌搜索引擎入口
  • 怎样做京东网站域名服务器地址查询
  • 怎样做线上销售公司网站seo公司
  • 万能应用商店下载安装厦门seo优化外包公司
  • 如何查一个网站的备案信息营销策划师
  • 好的建设网站公司哪家好友情链接收录
  • 万全做网站wl17581品牌策划ppt案例
  • 武汉市二手房交易合同备案在那个网站上做呀微信推广方案
  • 中国建设银行福州招聘信息网站如何注册域名网站
  • 上海市企业服务云平台重庆关键词优化软件
  • 网页设计制作公司价格便宜手机卡顿优化软件
  • 做机械的外贸网站搜索引擎seo优化平台
  • 做网站和推广工资多少钱云盘搜索
  • 宁波品牌网站建设打造龙头建设示范
  • 游戏代理好做吗百度搜索优化软件