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

淮安哪有专业做网站的公司汕头网站建设平台

淮安哪有专业做网站的公司,汕头网站建设平台,网站建设有什么看法,建设企业网站企业网上银行对公http://codeforces.com/contest/459/problem/D 题意:给你n个数,然后统计多少组(i,j)使得f(1,i,ai)>f(j,n,aj); 思路:先从左往右统计f(1,i,ai)记录在b[i],然后从右往左统计f(j,n,aj)记录在c[i],然后利用树状数组统计…

http://codeforces.com/contest/459/problem/D

题意:给你n个数,然后统计多少组(i,j)使得f(1,i,ai)>f(j,n,aj);

思路:先从左往右统计f(1,i,ai)记录在b[i],然后从右往左统计f(j,n,aj)记录在c[i],然后利用树状数组统计个数即可。

 1 #include <cstdio>
 2 #include <iostream>
 3 #include <cstring>
 4 #include <cmath>
 5 #include <queue>
 6 #include <map>
 7 #include <algorithm>
 8 #define maxn 1000010
 9 #define ll long long
10 using namespace std;
11 const int inf=1<<30;
12 
13 int n,m;
14 ll a[maxn];
15 ll b[maxn];
16 ll c[maxn];
17 ll y[maxn];
18 ll xx[maxn];
19 ll vis1[maxn],vis2[maxn];
20 
21 int lowbit(int x)
22 {
23     return x&(-x);
24 }
25 
26 void Insert(int x,ll val)
27 {
28     while(x<maxn)
29     {
30         y[x]+=val;
31         x+=lowbit(x);
32     }
33 }
34 
35 ll Getsum(int x)
36 {
37     ll ans=0;
38     while(x>0)
39     {
40         ans+=y[x];
41         x-=lowbit(x);
42     }
43     return ans;
44 }
45 
46 int main()
47 {
48     scanf("%d",&n);
49     for(int i=1; i<=n; i++)
50     {
51         scanf("%lld",&a[i]);
52         xx[i]=a[i];
53     }
54     sort(xx+1,xx+1+n);
55     int cnt=1;
56     for(int i=2; i<=n; i++)
57     {
58         if(xx[i-1]!=xx[i])
59         {
60             xx[++cnt]=xx[i];
61         }
62     }
63     for(int i=1; i<=n; i++)
64     {
65         int pos=lower_bound(xx+1,xx+cnt+1,a[i])-xx;
66         vis1[pos]++;
67         b[i]=vis1[pos];
68     }
69     for(int i=n; i>=1; i--)
70     {
71         int pos=lower_bound(xx+1,xx+cnt+1,a[i])-xx;
72         vis2[pos]++;
73         c[i]=vis2[pos];
74     }
75     ll ans=0;
76     for(int i=n; i>=1; i--)
77     {
78         ans+=Getsum(b[i]-1);
79         Insert(c[i],1);
80     }
81     printf("%I64d\n",ans);
82     return 0;
83 }
View Code

 

转载于:https://www.cnblogs.com/fanminghui/p/4348462.html

http://www.lbrq.cn/news/2650645.html

相关文章:

  • 重庆市建设工程信息网证书查询百度seo优化培训
  • 网站开发中背景图片怎么弄全屏今日早间新闻
  • 全自动网站制作系统全自动推广软件
  • 网站信息备案查询济南网站优化
  • 中山建网站推荐军事新闻头条
  • 网站开发济南青岛seo网站建设公司
  • 扬州网站建设沧州网站优化公司
  • 南昌市卫健委最新发布跟我学seo
  • 网站建设要注意那些问题社会化媒体营销
  • wordpress付费阅读主题优化seo深圳
  • 电子商务基础平台有哪些北京seo推广优化
  • 政府三级网站制度建设百度下载免费安装到桌面
  • 自己做销售独立网站抖音关键词优化排名
  • 笔记本做网站在线网页制作工具
  • 帮别人做彩票网站犯法嘛百度云搜索引擎官网入口
  • 麻城做网站百度知道问答
  • 深圳优化公司样高粱seo充电宝seo关键词优化
  • 杭州网站建设多少钱虎门今日头条新闻
  • web2.0 网站模板南宁seo外包平台
  • 七宝做网站seo搜索引擎优化培训班
  • wordpress同步到本地外贸网站seo教程
  • 如何完整保存网站并做修改一般网站推广要多少钱
  • 网站蜘蛛屏蔽怎样恢复数据分析网站
  • 商丘网站建设的公司哪家好文案写作软件app
  • 专业集团门户网站建设线上推广平台都有哪些
  • 青龙县建设局网站信阳seo推广
  • 杭州手机网站建设公司 网络服务媒体发稿公司
  • 石家庄做网站公司的电话网站推广该怎么做
  • 做私活 网站百度健康人工客服电话24小时
  • 舟山建设银行纪念币预约网站免费招聘信息发布平台
  • 关于城市农村创业的一点构想
  • UE破碎Chaos分配模型内部面材质
  • 搭建若依前后端分离版本的开发环境
  • Codeforces 思维训练(二)
  • 机器学习——支持向量机(SVM)实战案例
  • 在 Debian 系统上安装 Redis服务