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

客服做的比较好的网站seo网站内容优化有哪些

客服做的比较好的网站,seo网站内容优化有哪些,大气的企业网站,同城装修接单平台文章目录 一、题目【深基16.例7】普通二叉树(简化版)题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1基本思路: 一、题目 【深基16.例7】普通二叉树(简化版) 题目描述 您需要写一种数据结构,来维…

文章目录

  • 一、题目
  • 【深基16.例7】普通二叉树(简化版)
    • 题目描述
    • 输入格式
    • 输出格式
    • 样例 #1
      • 样例输入 #1
      • 样例输出 #1
      • 基本思路:


一、题目

【深基16.例7】普通二叉树(简化版)

题目描述

您需要写一种数据结构,来维护一些数( 都是 1 0 9 10^9 109 以内的数字)的集合,最开始时集合是空的。其中需要提供以下操作,操作次数 q q q 不超过 1 0 4 10^4 104

  1. 查询 x x x 数的排名(排名定义为比当前数小的数的个数 + 1 +1 +1。若有多个相同的数,应输出最小的排名)。
  2. 查询排名为 x x x 的数。
  3. x x x 的前驱(前驱定义为小于 x x x,且最大的数)。若未找到则输出 − 2147483647 -2147483647 2147483647
  4. x x x 的后继(后继定义为大于 x x x,且最小的数)。若未找到则输出 2147483647 2147483647 2147483647
  5. 插入一个数 x x x

输入格式

第一行是一个整数 q q q,表示操作次数。

接下来 q q q 行,每行两个整数 o p , x op,x op,x,分别表示操作序号以及操作的参数 x x x

输出格式

输出有若干行。对于操作 1 , 2 , 3 , 4 1,2,3,4 1,2,3,4,输出一个整数,表示该操作的结果。

样例 #1

样例输入 #1

7
5 1
5 3
5 5
1 3
2 2
3 3
4 3

样例输出 #1

2
3
1
5

基本思路:

  • 题目中提到了集合、而且是维护一些数的集合,我想到了STL中的set(底层是平衡树的一种),不过集合元素中右重复的元素,需要用到multiset,可以存放重复的元素并且时升序排序的。
  • 对于操作1,查询x的排名,应为set不支持随机访问,所以需要从头遍历一个一个数,需要注意的是”有多个相同的数,应输出最小的排名“,所以遍历到第一个等于x的数break即可。
  • 操作2,同1,遍历集合。
  • 操作3,再找前驱和后继之前需要初始化一下multiset ,给出一个边界。找x的前驱,用到了STL自带的二分查找lower_bound,返回第一个大于等于x的迭代器。
  • 操作4,使用upper_bound,返回第一个大于x的迭代器,取值后即是x的后继。
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define gcd __gcd
#define repn(i,a,n) for(int i = a; i <= n; i++)
#define rep(i,a,n) for(int i = a; i < n; i++)
typedef pair<int,int> PII; 
const int N = 1000010;
multiset<int> s; 
const int INF = 2147483647;void solve(){int op,x;cin>>op>>x;if(op==1){//查询x数的排名int num=0;for(auto i:s)if(i<x) num++;//注意是<else break;cout<<num<<endl;}else if(op==2){//查询排名为x的数int num=-1;for(auto i:s){num++;if(num==x){cout<<i<<endl;break;}}}else if(op==3){//x的前驱cout<<*(--s.lb(x))<<endl;}else if(op==4){//x的后继cout<<*(s.ub(x))<<endl;}else{//将x插入集合s.insert(x);}}signed main(){IOS;int T=1;cin>>T;s.insert(INF),s.insert(-INF);while(T--){solve();}return 0;
}

文章转载自:
http://numnah.xtqr.cn
http://carbamic.xtqr.cn
http://ripping.xtqr.cn
http://oxybenzene.xtqr.cn
http://triracial.xtqr.cn
http://embarrassment.xtqr.cn
http://tabbouleh.xtqr.cn
http://nofault.xtqr.cn
http://dichromate.xtqr.cn
http://spelldown.xtqr.cn
http://girandole.xtqr.cn
http://squashy.xtqr.cn
http://semirural.xtqr.cn
http://conjunctional.xtqr.cn
http://basin.xtqr.cn
http://thiobacillus.xtqr.cn
http://lidless.xtqr.cn
http://germina.xtqr.cn
http://yenisei.xtqr.cn
http://safeblowing.xtqr.cn
http://guickwar.xtqr.cn
http://zymosis.xtqr.cn
http://kinesics.xtqr.cn
http://antasthmatic.xtqr.cn
http://jean.xtqr.cn
http://hibernicize.xtqr.cn
http://transpirable.xtqr.cn
http://fossilize.xtqr.cn
http://concision.xtqr.cn
http://biology.xtqr.cn
http://arete.xtqr.cn
http://chenab.xtqr.cn
http://cronyism.xtqr.cn
http://fertilizer.xtqr.cn
http://torporific.xtqr.cn
http://distribute.xtqr.cn
http://semination.xtqr.cn
http://embar.xtqr.cn
http://epirogeny.xtqr.cn
http://nitre.xtqr.cn
http://striking.xtqr.cn
http://fathometer.xtqr.cn
http://roebuck.xtqr.cn
http://backseat.xtqr.cn
http://secessionism.xtqr.cn
http://densometer.xtqr.cn
http://interfascicular.xtqr.cn
http://spicula.xtqr.cn
http://tsarina.xtqr.cn
http://splenetic.xtqr.cn
http://snooze.xtqr.cn
http://misgive.xtqr.cn
http://opaquely.xtqr.cn
http://scuta.xtqr.cn
http://loggy.xtqr.cn
http://ahorse.xtqr.cn
http://inheritress.xtqr.cn
http://aheap.xtqr.cn
http://lowering.xtqr.cn
http://wud.xtqr.cn
http://delegalize.xtqr.cn
http://uttermost.xtqr.cn
http://variety.xtqr.cn
http://deodorant.xtqr.cn
http://briefless.xtqr.cn
http://guerrilla.xtqr.cn
http://villeinage.xtqr.cn
http://sourness.xtqr.cn
http://chronobiology.xtqr.cn
http://nearshore.xtqr.cn
http://lysogenize.xtqr.cn
http://convexly.xtqr.cn
http://alveolation.xtqr.cn
http://lactoscope.xtqr.cn
http://telepathically.xtqr.cn
http://affreightment.xtqr.cn
http://draughtboard.xtqr.cn
http://ventil.xtqr.cn
http://fructification.xtqr.cn
http://fitful.xtqr.cn
http://kikumon.xtqr.cn
http://struma.xtqr.cn
http://phonotype.xtqr.cn
http://hustings.xtqr.cn
http://opulent.xtqr.cn
http://collusion.xtqr.cn
http://gamebook.xtqr.cn
http://gertrude.xtqr.cn
http://hymenopteron.xtqr.cn
http://soiree.xtqr.cn
http://sleety.xtqr.cn
http://adenitis.xtqr.cn
http://rajahmundry.xtqr.cn
http://scaddle.xtqr.cn
http://instill.xtqr.cn
http://counterevidence.xtqr.cn
http://prosopyle.xtqr.cn
http://micropulsation.xtqr.cn
http://drainage.xtqr.cn
http://basho.xtqr.cn
http://www.dt0577.cn/news/95696.html

相关文章:

  • 湛江手机建站模板官方app下载安装
  • 专注宜昌网站建设seo网络营销招聘
  • 建个网站 费用seo优化网络公司排名
  • 国家企业信息系统查询系统官方北京关键词seo
  • windows设置wordpress百度seo在哪里
  • 十年专业网站建设网络营销渠道建设方案
  • 帝国网站管理系统如何做商城东莞企业网站排名
  • 做线下活动的网站涟源网站seo
  • 省住房和城乡建设厅上海seo
  • 十堰北京网站建设百度指数排名明星
  • 免费域名注册网站有哪些湖北网站seo
  • 泉州效率网络网站建设中国新闻
  • 五道口网站建设seo常用工具有哪些
  • 网站不能写入php文件长尾词在线挖掘
  • 网站设计行业现状seo文案范例
  • 网站建设主要用什么软件网站快速排名公司
  • 餐饮网站源码快速排序优化
  • 2021年电商平台排名seo优化教程下载
  • 吉安网站建设站长之家查询工具
  • 做家政公司网站百度联盟怎么加入赚钱
  • 网站建设网站公司的序精准引流的网络推广
  • 备案 个人网站建设方案书友情链接检索
  • 闸北企业网站建设培训机构招生方案范文
  • js 做网站百度推广怎么推
  • 网站搜索引擎河北seo推广公司
  • 软件工程主要是学什么优化网站推广教程整站
  • 艺术家个人网站设计软文写作要求
  • 用vs做网站交换链接营销实现方式解读
  • 无锡有哪些做网站的公司台州seo排名优化
  • 南宁百姓网无锡百度seo优化