[Done] Codeforces Round #562 (Div. 2) 题解
模拟几百步就可以了。
爆搜一下,时间复杂度大概是 $O(4 * n)$
Code: 56306723
二分答案,然后验证一下就好了,第一个数越小越好,之后的数都要求和前一个相等或者大一点。复杂度 $n * log(n)$
对于每一个 $i$,需要计算出最小的 $x$,使得 $s[i-x] = s[x] = s[i + x]$,对于 $i$ 而言,如果区间左端点在 $[1, i - x]$ 且右端点在 $[i + x, n]$,这样的区间就是合法区间。
处理出每一个合法区间集合:左端点在 $[1, i - x]$ 且右端点在 $[i + x, n]$,最后的工作就是去重,计算有多少种不同的区间。这个可以用矩形面积并来解决,不赘述。
这题的复杂度我不太会计算,第一步我是暴力算出来的,看似 $O(n^2)$ 的操作,结果好像很快就跑过去了。
Code:56313123
E - And Reachability
这题是比较标准的有向无环图上的 dp 题。
处理出 $dp[i][j]$ 表示第 $i$ 个位置的数字往后走,走到二进制第 $j$ 为是 $1$ 的离 $i$ 最近位置。
如果知道了 $dp[i][j]$,那么我们可以枚举最后一步如何跳到位置 $y$,必然是枚举 $y$ 的二进制的中的 $1$。
复杂度:$O(n*logn*logn)$
Code:56545084
[Done] Codeforces Round #562 (Div. 2) 题解的更多相关文章
- Codeforces Round #182 (Div. 1)题解【ABCD】
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...
- Codeforces Round #608 (Div. 2) 题解
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...
- Codeforces Round #525 (Div. 2)题解
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...
- Codeforces Round #528 (Div. 2)题解
Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...
- Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F
Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...
- Codeforces Round #677 (Div. 3) 题解
Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...
- Codeforces Round #665 (Div. 2) 题解
Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...
- Codeforces Round #160 (Div. 1) 题解【ABCD】
Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...
- Codeforces Round #383 (Div. 2) 题解【ABCDE】
Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...
随机推荐
- 树莓派python 控制GPIO
sudo pip install rpi.gpio #!/usr/bin/env python # encoding: utf-8 import RPi.GPIO as GPIO import tim ...
- Navicat Premium 12 mysql show error: connection is being used
错误原因:连接数满了. 解决方案:杀掉无用连接,释放资源.
- 【转载】 DeepMind发表Nature子刊新论文:连接多巴胺与元强化学习的新方法
原文地址: baijiahao.baidu.com/s?id=1600509777750939986&wfr=spider&for=pc 机器之心 18-05-15 14:26 - ...
- 实战二:LoadRunner创建一个测试脚本
问题一:执行脚本浏览器不能自动启动??? 原因:loadrunner11只支持IE9以下浏览器和火狐低版本浏览器 解决办法:1.IE浏览器取消勾选[启用第三方浏览器扩展]启动IE,从[工具]进入[In ...
- 【439】Tweets processing by Python
参数说明: coordinates:Represents the geographic location of this Tweet as reported by the user or cl ...
- 【432】COMP9024,Exercise9
eulerianCycle.c What determines whether a graph is Eulerian or not? Write a C program that reads a g ...
- 报错:MetaException(message:Version information not found in metastore. )
报错背景: CDH安装完成hive后启动失败. 报错现象: [main]: Metastore Thrift Server threw an exception... MetaException(me ...
- Day2作业:购物商城
ReadMe: 注意事项: 1.本程序需要提前安装prettytable模块,在商品展示时使用了prettytable 2.数据库使用json模块,有中文数据,在mac系统上编写,运行没有出现问题,在 ...
- ABAP DEMO33 选择周的搜索帮助
效果图 *&---------------------------------------------------------------------**& Report YCX_02 ...
- 【Leetcode_easy】867. Transpose Matrix
problem 867. Transpose Matrix solution: class Solution { public: vector<vector<int>> tra ...