题解-CF1437F Emotional Fishermen】的更多相关文章

题面 CF1437F Emotional Fishermen 给 \(n\) 个数的序列 \(a_i\),求有多少种 \(n\) 个数的排列 \(p_i\),使得 \[\frac{a_{p_i}}{\max_{j=1}^{i-1} a_{p_j}}\notin \left(\frac 12, 2\right) \] 答案膜 \(998244353\). 数据范围:\(2\le n\le 5000\). 题解 您会很高兴地发现当前 \(a_{p_i}\) 大于前面最大值的总次数不会超过 \(\lo…
题意 给出数列\(a_i\),求排列\(p_i\)的数量满足 \[\frac{a_{p_i}}{max_{j=1}^{i-1}a_{p_j}} \notin (\frac{1}{2},2) \] 思路 数列可以按前缀最大值相同划分为几个连续段,不妨设第\(i\)段开头(即前缀最大值)为\(m_i\),满足\(2m_i \leq m_{i+1}\),第\(i\)段内元素\(x\)满足\(2x \leq m_i\), 于是有一个\(dp\)做法,\(dp_i\)表示当前段开头为\(a_i\),枚举上…
补了一场Edu round. A : Marketing Scheme 水题 #include <cstdio> #include <algorithm> typedef long long ll; int T,l,r; template <typename T> inline void read(T &x){ x = 0; char ch = getchar(); int f = 1; for(;ch < '0' || ch > '9'; ch =…
题面:https://www.cnblogs.com/Juve/articles/11558523.html A:Emotional Flutter 如果起点确定,那么我们后面走的点都是固定的,及mod k余数相同 如果路径中有一个%k在黑块里,那么这个起点是不可行的 然后我们可以对于所有黑块,看它限制了哪些余数 最后我们要判断的就是有没有一个长度为s的连续区间,使得它没有被限制 #include<iostream> #include<cstdio> #include<alg…
传送门 因为一个等号挂掉了10pts 发现每个黑色段一定对应了一段不可行的出发区间 检查是否存在所有黑色段的并集的补集即可 具体来说,我们对于每个黑色段计算出一个(有的是两个)区间 \([l, r]\) ,把它们全合并,看有没有剩下的位置 Code: #include <bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f #define N 500010 #define ll long long //#define int lo…
我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我没看,看不懂. 基本思路:我不会. 参考代码:找Oyk老师和Czj老师去. B. The background of water problem 题目大意(大写加粗的水题):给定$N$个学生和他们$K$个科目的成绩$S_i$,再给出各科目$K_i$的权重顺序$Q_i$,求排名之后,拥有id为$X$的…
以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <string> #include <bitset> #include <vector> #include <…
2561: 最小生成树(题解) Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1628  Solved: 786 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2561 Description 给定一个边带正权的连通无向图G=(V,E),其中N=|V|,M=|E|,N个点从1到N依次编号,给定三个正整数u,v,和L (u≠v),假设现在加入一条边权为L的边(u,v),那么需要删掉最少多少条…
Problems     # Name     A Infinite Sequence standard input/output 1 s, 256 MB    x3509 B Restoring Painting standard input/output 1 s, 256 MB    x2519 C Money Transfers standard input/output 1 s, 256 MB    x724 D Tree Construction standard input/outp…
题目链接 提交连接:http://acm-software.hrbust.edu.cn/problemset.php?page=5 1470-1482 只做出来四道比较水的题目,还需要加强中等题的训练. 题解: E666 这个题是让求有多少个子串只含有6.寻找连续的6,然后用n*(n+1)/2求出这一段的子串个数,然后把每一段连续的加起来. 做的时候wa了很多次,原来是在n*(n+1)的地方已经超过int型了,所以需要设置类型为long long. #include <cstdio> #inc…