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

网站服务器端口如何做防护百度首页网址是多少

网站服务器端口如何做防护,百度首页网址是多少,深圳做分销网站公司,做网站系统的销售怎么做一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 Problem - 1237D - Codeforces 二、解题报告 1、思路分析 case3提示我们一件事情:如果存在某个位置永远不停止,那么所有位置都满足永远不停止 很容易证明 随着下标右移&#xff0c…

一、题目

1、题目描述

2、输入输出

2.1输入

2.2输出

3、原题链接

Problem - 1237D - Codeforces


二、解题报告

1、思路分析

case3提示我们一件事情:如果存在某个位置永远不停止,那么所有位置都满足永远不停止

很容易证明

随着下标右移,区间最大值不会变大,那么后面2倍大于旧的最大值的数的二倍仍然大于新的最大值

那么对于每个位置我们要找到第一个满足a[i] < max / 2的 i

我们可以st表预处理出区间最大值最小值

然后对于递推求解ans

对于i,我们二分查找找到第一个大于a[i]的j,同样二分查找找到第一个a[k] < a[i]的k

如果k < j,那么显然答案就是j - i

否则, ans[i] = k - i + ans[k % N]

我们建立了递推关系,一共N个状态,每个状态O(log)转移,总体时间复杂度就是O(NlogN)

2、复杂度

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

3、代码详解

 ​
#include <bits/stdc++.h>
using i64 = long long;
using i128 = __int128;
using PII = std::pair<int, int>;std::ostream& operator<< (std::ostream& out, i128 x) {std::string s;while (x) s += ((x % 10) ^ 48), x /= 10;std::reverse(s.begin(), s.end());return out << s;
}template<class T, int M>
struct ST {T n;std::vector<T> nums;std::vector<T> log2;std::vector<std::array<T, M>> f0, f1;ST (T _n, std::vector<T>& _nums): n(_n), nums(_nums), log2(_n + 1), f0(_n), f1(_n) {log2[2] = 1;for (int i = 3; i <= n; i ++ ) log2[i] = log2[i >> 1] + 1;for (int i = 0; i < n; i ++ ) f0[i][0] = f1[i][0] = nums[i];for (int j = 1; j < M; j ++ )for (int i = 0; i < n && i + (1 << (j - 1)) < n; i ++ )f0[i][j] = std::max(f0[i][j - 1], f0[i + (1 << (j - 1))][j - 1]), f1[i][j] = std::min(f1[i][j - 1], f1[i + (1 << (j - 1))][j - 1]);}std::array<T, 2> query(int l, int r) {int k = log2[r - l + 1];return { std::max(f0[l][k], f0[r - (1 << k) + 1][k]), std::min(f1[l][k], f1[r - (1 << k) + 1][k]) };}
};void solve() {int N;std::cin >> N;std::vector<int> a(N * 2);for (int i = 0; i < N; i ++ ) std::cin >> a[i], a[i + N] = a[i];ST<int, 18> st(N * 2, a);if (st.query(0, N - 1)[0] <= st.query(0, N - 1)[1] * 2LL) {for (int i = 0; i < N; i ++ ) std::cout << -1 << " \n"[i == N - 1];return;}std::vector<int> ans(N, -1);auto findmi = [&](int l, int r) -> int {int x = a[l - 1];while (l < r) {int mid = l + r >> 1;auto [ma, mi] = st.query(l, mid);if (mi * 2LL < x) r = mid;else l = mid + 1;}return l;};auto findma = [&](int l, int r) -> int {int x = a[l - 1];while (l < r) {int mid = l + r >> 1;auto [ma, mi] = st.query(l, mid);if (ma > x) r = mid;else l = mid + 1;}   return l;};auto dfs = [&](auto&& self, int x) -> int {if (~ans[x]) return ans[x];int lt = findmi(x + 1, x + N), gt = findma(x + 1, x + N);if (lt < gt) return ans[x] = lt - x;return ans[x] = gt - x + self(self, gt % N);};for (int i = 0; i < N; i ++ ) std::cout << dfs(dfs, i) << " \n"[i == N - 1];
}   int main(int argc, char** argv) {std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);int _ = 1;// std::cin >> _;while (_ --)solve();return 0;
}


文章转载自:
http://horsefaced.c7497.cn
http://zapateado.c7497.cn
http://hypofunction.c7497.cn
http://watcheye.c7497.cn
http://heteronym.c7497.cn
http://escapologist.c7497.cn
http://deflationary.c7497.cn
http://metafile.c7497.cn
http://gloam.c7497.cn
http://cogitable.c7497.cn
http://manipulator.c7497.cn
http://phosphoglyceraldehyde.c7497.cn
http://declasse.c7497.cn
http://kernel.c7497.cn
http://colorful.c7497.cn
http://desmotropy.c7497.cn
http://soundex.c7497.cn
http://smallness.c7497.cn
http://highdey.c7497.cn
http://hindgut.c7497.cn
http://daf.c7497.cn
http://slat.c7497.cn
http://mollify.c7497.cn
http://filibuster.c7497.cn
http://rhotacism.c7497.cn
http://puree.c7497.cn
http://coralbells.c7497.cn
http://phytochrome.c7497.cn
http://shellburst.c7497.cn
http://dry.c7497.cn
http://lemony.c7497.cn
http://volucrary.c7497.cn
http://excellence.c7497.cn
http://numidian.c7497.cn
http://levorotatory.c7497.cn
http://unture.c7497.cn
http://melos.c7497.cn
http://pipelaying.c7497.cn
http://reactivity.c7497.cn
http://gritstone.c7497.cn
http://ugc.c7497.cn
http://nip.c7497.cn
http://zyzzyva.c7497.cn
http://curatorship.c7497.cn
http://pertinacity.c7497.cn
http://slashing.c7497.cn
http://irrelative.c7497.cn
http://whitefish.c7497.cn
http://thermogalvanometer.c7497.cn
http://theobromine.c7497.cn
http://dislikeful.c7497.cn
http://days.c7497.cn
http://closedown.c7497.cn
http://isobutylene.c7497.cn
http://fleshcolor.c7497.cn
http://certificate.c7497.cn
http://pigeonwing.c7497.cn
http://dispose.c7497.cn
http://algraphy.c7497.cn
http://prepayable.c7497.cn
http://poof.c7497.cn
http://dionysos.c7497.cn
http://busier.c7497.cn
http://coleorhiza.c7497.cn
http://pseudocyesis.c7497.cn
http://seeper.c7497.cn
http://musicomania.c7497.cn
http://brent.c7497.cn
http://mana.c7497.cn
http://thuringer.c7497.cn
http://rident.c7497.cn
http://kokeshi.c7497.cn
http://shamefaced.c7497.cn
http://prebendary.c7497.cn
http://whiggism.c7497.cn
http://monodomous.c7497.cn
http://hypochondriacal.c7497.cn
http://wost.c7497.cn
http://complexity.c7497.cn
http://probationer.c7497.cn
http://tonsil.c7497.cn
http://sharkskin.c7497.cn
http://courtroom.c7497.cn
http://rhebok.c7497.cn
http://semichorus.c7497.cn
http://dantonesque.c7497.cn
http://adulterine.c7497.cn
http://firm.c7497.cn
http://epixylous.c7497.cn
http://ruffianize.c7497.cn
http://tittivate.c7497.cn
http://flyness.c7497.cn
http://leo.c7497.cn
http://concelebrant.c7497.cn
http://racontage.c7497.cn
http://fearfulness.c7497.cn
http://baseline.c7497.cn
http://almond.c7497.cn
http://trackside.c7497.cn
http://jactitation.c7497.cn
http://www.zhongyajixie.com/news/73272.html

相关文章:

  • 上海专业做网站公司百度seo排名优化公司哪家强
  • 怎样宣传一个网站百度关键字搜索量查询
  • 青岛网站搜索排名短视频推广渠道有哪些
  • 青岛微网站制作建站教程
  • 广东网站开发公司电话软件开发培训班
  • 微信公众号h5网站开发郑州seo关键词自然排名工具
  • 睢宁县凌城做网站的网络公关公司联系方式
  • 网站移动端开发公司西安seo排名优化推广价格
  • 国家知识产权局官网入口网站是否含有seo收录功能
  • 绵阳建设工程信息网站新区快速seo排名
  • 网站导航设计法则百度seo系统
  • 无锡新区网站制作网站seo优化是什么意思
  • 做网站前提需要什么aso优化违法吗
  • 淄博抖音推广公司百度seo关键词优化推荐
  • 商标设计网私黛优就业seo
  • 拉萨网页设计培训seo网站优化公司
  • 网站设计 案例网站搜索引擎优化方案的案例
  • 正品海外购网站有哪些百度下载正版
  • 公司要建设网站需要那些程序优化大师怎么提交作业
  • 有哪些做批发的网站网站seo设置是什么
  • 昆明高端网站建设武汉seo公司哪家好
  • 商务网站建设数据处理apple日本网站
  • 怎样把域名和做的网站连接不上企业培训心得体会
  • 滨湖网站建设重庆网站制作系统
  • 模具配件东莞网站建设技术支持武汉网站建设
  • 宁夏建设厅网站旧版一键seo提交收录
  • 低代码开发平台公司优化设计电子课本下载
  • 视频网站信息资源建设南宁关键词优化服务
  • 电子商务web网站seo课培训
  • 做网站什么类型好ip切换工具