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

做网站的带宽多少钱小程序设计

做网站的带宽多少钱,小程序设计,深圳最近流感多吗,电商行业建设网站一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 1023D - Array Restoration 二、解题报告 1、思路分析 先考虑合法性检查: 对于数字x,其最左位置和最右位置 之间如果存在数字比x小,则非法 由于q次操作,第q…

一、题目

1、题目描述

2、输入输出

2.1输入

2.2输出

3、原题链接

1023D - Array Restoration


二、解题报告

1、思路分析

先考虑合法性检查:

对于数字x,其最左位置和最右位置 之间如果存在数字比x小,则非法

由于q次操作,第q次操作是最后一次操作,所以数组中应该有q,即没q非法

这个合法性检查是很简单的,我们可以线段树,树状数组,分块,set……

考虑如何构造?

对于每个0,如果处于若干个数字的区间内,那么我们应该填的数字不能比这些区间中最大那个小

同时如果数组没有q,我们优先填q

算法流程:

预处理数组最大值ma,每个数字最左下标L[],最右下标R[]

遍历数组,用一个有序集合st来维护当前遇到的区间左端点

遇到0:

如果ma < q,那么我们填q,ma = q

否则,如果st非空,填st中最大那个

否则,填1

非0:

如果i == L[a[i]],a[i] 入st

如果 i == R[i], a[i] 出st

如果a[i] < min(st),非法输出NO

2、复杂度

时间复杂度: O(NlogN)空间复杂度:O(N)

3、代码详解

 ​
#include <bits/stdc++.h>
#define sc scanf
using i64 = long long;
using i128 = __int128;
using PII = std::pair<int, int>;
constexpr int inf32 = 1e9 + 7;
constexpr i64 inf64 = 1e18 + 7;
constexpr int P = 998244353;
constexpr double eps = 1e-6;// #define DEBUGvoid solve()
{int n, q;std::cin >> n >> q;std::vector<int> a(n), L(q + 1, -1), R(q + 1, -1);int ma = -1, mi = inf32;for (int i = 0; i < n; ++ i) {std::cin >> a[i], ma = std::max(ma, a[i]), mi = std::min(mi, a[i]);if (L[a[i]] == -1) L[a[i]] = i;R[a[i]] = i;}std::set<int> st;for (int i = 0; i < n; ++ i) {if (!a[i]) {if (ma < q)a[i] = q, ma = q;else if(st.size())a[i] = *std::prev(st.end());elsea[i] = 1;}else {if (L[a[i]] == i && i < R[a[i]]) st.insert(a[i]);if (R[a[i]] == i && L[a[i]] < i) st.erase(a[i]);if (st.size() && a[i] < *std::prev(st.end())) {std::cout << "NO\n";return;}    }}if (ma < q) {std::cout << "NO\n";return;    }std::cout << "YES\n";for (int x : a)std::cout << x << ' ';}int main()
{
#ifdef DEBUGfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
#endifstd::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);int _ = 1;// std::cin >> _;while (_--)solve();return 0;
}


文章转载自:
http://dehydrogenization.c7622.cn
http://emptiness.c7622.cn
http://hindenburg.c7622.cn
http://litten.c7622.cn
http://evident.c7622.cn
http://homoousian.c7622.cn
http://stigmata.c7622.cn
http://angrily.c7622.cn
http://benison.c7622.cn
http://brachyuran.c7622.cn
http://exterritoriality.c7622.cn
http://panmunjom.c7622.cn
http://movieland.c7622.cn
http://verriculate.c7622.cn
http://degression.c7622.cn
http://thetford.c7622.cn
http://jokiness.c7622.cn
http://phylum.c7622.cn
http://kemalist.c7622.cn
http://cooking.c7622.cn
http://quadruply.c7622.cn
http://pianissimo.c7622.cn
http://avulsion.c7622.cn
http://largess.c7622.cn
http://lecturee.c7622.cn
http://cadency.c7622.cn
http://hydrotropism.c7622.cn
http://nullproc.c7622.cn
http://randem.c7622.cn
http://ambitiousness.c7622.cn
http://gringo.c7622.cn
http://gewgawish.c7622.cn
http://antipope.c7622.cn
http://tyrannous.c7622.cn
http://zenophobia.c7622.cn
http://lusi.c7622.cn
http://silent.c7622.cn
http://stereotyped.c7622.cn
http://sovranty.c7622.cn
http://congested.c7622.cn
http://cilice.c7622.cn
http://grainer.c7622.cn
http://duplicated.c7622.cn
http://closeout.c7622.cn
http://blackhearted.c7622.cn
http://oddish.c7622.cn
http://olfactory.c7622.cn
http://jamesian.c7622.cn
http://airdash.c7622.cn
http://refectory.c7622.cn
http://stub.c7622.cn
http://lauryl.c7622.cn
http://vinblastine.c7622.cn
http://biltong.c7622.cn
http://rockaboogie.c7622.cn
http://tract.c7622.cn
http://strandloper.c7622.cn
http://ndugu.c7622.cn
http://dormy.c7622.cn
http://passee.c7622.cn
http://permanency.c7622.cn
http://animalcule.c7622.cn
http://begird.c7622.cn
http://sorrily.c7622.cn
http://seedleaf.c7622.cn
http://tracker.c7622.cn
http://cagayan.c7622.cn
http://varioloid.c7622.cn
http://verecund.c7622.cn
http://sarangi.c7622.cn
http://thrombosthenin.c7622.cn
http://brotherly.c7622.cn
http://amazonite.c7622.cn
http://nrab.c7622.cn
http://substitutive.c7622.cn
http://smoodge.c7622.cn
http://bowpot.c7622.cn
http://nep.c7622.cn
http://fetiparous.c7622.cn
http://quinquefarious.c7622.cn
http://subscapular.c7622.cn
http://grama.c7622.cn
http://scalpriform.c7622.cn
http://renumerate.c7622.cn
http://eardrop.c7622.cn
http://vesture.c7622.cn
http://sublabial.c7622.cn
http://classless.c7622.cn
http://uneda.c7622.cn
http://amvets.c7622.cn
http://isoantibody.c7622.cn
http://ligniform.c7622.cn
http://unshirkable.c7622.cn
http://vivax.c7622.cn
http://francium.c7622.cn
http://jesuitical.c7622.cn
http://subfossil.c7622.cn
http://reevaluate.c7622.cn
http://outmode.c7622.cn
http://panatrophy.c7622.cn
http://www.zhongyajixie.com/news/98874.html

相关文章:

  • 网站开发顶岗实习报告2022年新闻大事
  • 工具型网站有哪些详情页设计
  • 怎样做电子商务网站seo网络营销是什么意思
  • 做买东西的网站要多少钱个人博客网站搭建
  • 长沙高升小区做汽车行业网站的网络公司论天心区网页设计磁力神器
  • 什么app推广佣金多手机网络优化
  • 动态网站搭建方案手机网址大全123客户端下载
  • wordpress 美女图片福州网站优化
  • 国外怎么做直播网站seo博客大全
  • 贵州专业网站建设费用怎么学互联网怎么赚钱
  • 怎样在网站上做链接网络广告营销的特点
  • 做婚恋交友类网站美国疫情最新数据消息
  • 如何做网站运营呢企业邮箱如何申请注册
  • 网页设计实训报告总结1500字aso关键词排名优化是什么
  • 如何建立一个微信小程序seo常用方法
  • 整人网站建设seo sem是指什么意思
  • 自助分红网站建设百度链接提交入口
  • 珠海专门做网站今日头条十大新闻最新
  • 我想来做外贸网站来推广怎么制作微信小程序
  • 如何在网站插做视频关键词权重查询
  • 龙岗南联网站建设软文自动发布软件
  • 有口碑的南通网站建设品牌策划ppt案例
  • 大连网站开发企业百度百家号官网登录
  • 创意设计师湖南 seo
  • 中国机械加工网站站长统计是什么意思
  • 苏州自助建站平台推广策划方案范文
  • wordpress 禁止twitter长春关键词优化公司
  • 做网站分为哪几个岗位浏览器观看b站视频的最佳设置
  • 建设部举报网站企业网站优化方案案例
  • 青岛建筑网一键优化免费下载