https://nanti.jisuanke.com/t/31453 题目 有n个格子拉成一个环,给你k,你能使用任意个数的0 ~ 2^k - 1,规定操作 i XNOR j 为~(i  ^  j),要求相邻的格子的元素的XNOR为正数,问你有几种排法,答案取模1e9 + 7.本题所使用的数字为无符号位数字. 分析 因为都是无符号了,那么题目就是要求相邻的数同或的结果不为0,即异或的结果不为2^k-1. 第1个数有种选择,第2个数到第n-1个数都有种选择,第n个数有种选择 所以答案就是 可是当第…
https://nanti.jisuanke.com/t/31453 题目大意: 有n个人坐成一圈,然后有\(2^k\)种颜色可以分发给每个人,每个人可以收到相同的颜色,但是相邻两个人的颜色标号同或不能等于0,问分配方案数 注:以下所有的相同是指两个数同或为0 思路 通过观察得出在0-\[2^k-1\]的范围内对于每个数,与之同或为零的数是唯一的 首先举例尝试观察性质,假设第一个位置随便填,即有\[2^k\]种不同的填法,然后考虑第二个位置和第一个位置不同的填法有\[2^k-1\]种,然后考虑第…
题目链接 题意:有n个格子拉成一个环,给你k,你能使用任意个数的0 ~ 2^k - 1,规定操作 i XNOR j 为~(i  ^  j),要求相邻的格子的元素的XNOR为正数,问你有几种排法,答案取模1e9 + 7.本题所使用的数字为无符号位数字. 思路:无符号位,所以异或取反后为正数,只可能是两个数相加不为2^k - 1.所以转化为相邻两个数之和不为2^k - 1的排法有几种(首尾也不能).这个问题很像扇形涂色问题.我们开dp[ n ][ 3 ]记录到第i长时的三种情况:头尾和不为2^k -…
任意门:https://nanti.jisuanke.com/t/31453 A.Hard to prepare After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the show, every audience has to wear a Nogaku mask, a…
A. Hard to prepare After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the show, every audience has to wear a Nogaku mask, and seat around as a circle. There are…
ACM-ICPC 2018 徐州赛区网络预赛 A.Hard to prepare 枚举第一个选的,接下来的那个不能取前一个的取反 \(DP[i][0]\)表示选和第一个相同的 \(DP[i][1]\)表示选和第一个取反的 \(DP[i][2]\)表示选其他的 状态转移方程直接看代码好了 //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #inc…
ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx ,…
ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer master has to do his job. A tour company gives him a map which is a rectangle. The map consists of N \times MN×M little squares. That is to say, the h…
H.Ryuji doesn't want to study 27.34% 1000ms 262144K   Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i]. Unfortunately, the longer he learns, the fewer he gets. That…
传送门 题面: In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in the process of playing this game, you need to consta…
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in the process of playing this game, you need to constantly fac…
262144K   Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i]. Unfortunately, the longer he learns, the fewer he gets. That means, if he reads books from ll to rr, he…
262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dimension vector <x, y>. If xi​= xj​ and yi…
Mur loves hash algorithm, and he sometimes encrypt another one's name, and call him with that encrypted value. For instance, he calls Kimura KMR, and calls Suzuki YJSNPI. One day he read a book about SHA-256,which can transit a string into just 256 b…
链接 https://nanti.jisuanke.com/t/31456 参考题解  https://blog.csdn.net/ftx456789/article/details/82590044 #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fi first #define se second #define all(a) (a).begin(), (a).end() #define…
ACM-ICPC 2018 徐州赛区网络赛  去年博客记录过这场比赛经历:该死的水题  一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进.     D. Easy Math 题意:   给定 \(n\), \(m\) ,求 \(\sum _{i=1}^{m} \mu(in)\) .其中 $ 1 \le n \le 1e12$ , $ 1 \le m \le 2e9$ ,\(\mu(n)\) 为莫比乌斯函数.   思路:   容易知道,\(i\) 与 \(n\) 不互质时, \(\m…
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i]a[i]. Unfortunately, the longer he learns, the fewer he gets. That means, if he reads books from ll to rr, he will get a…
I. query 题目链接: Problem Description Given a permutation \(p\) of length \(n\), you are asked to answer \(m\) queries, each query can be represented as a pair \((l ,r )\), you need to find the number of pair \((i ,j)\) such that \(l \le i < j \le r\) a…
题目链接:https://nanti.jisuanke.com/t/A2007 题目大意:有一个序列含有n个数a[1],a[2],a[3],……a[n],有两种操作: 第一种操作:k=1,l,r,询问区间[l,r]中a[l]*len+a[l+1]*(len-1)+a[l+2]*(len-2)……+a[r]*1,其中len=(r-l+1),即区间长度 第二种操作:k=2,  l,r将下标为l的值a[l]修改为r 一共有q个询问,对于每个询问,如果k==1,输出答案即可. 解题思路:先进行一个小小的…
https://nanti.jisuanke.com/t/31455 题意 给一个3*3的方格填入 1-9 九个数 有些数是已知的,有些数是对方已知但我未知的,有些数是大家都未知的 我要计算取得最大的对应值的期望 分析 题意有点难懂. 首先先枚举把剩下的数填入星号的情况(其实就是枚举星号的排列),这是对方所能知道的所有信息,然后对方将取八种决策中最优的情况,而因为井号的存在,所以其排列也会影响每种决策的分数,所以接着要枚举井号的排列情况,对于每种情况累加每个决策的分数,最后枚举完后,要除以井号排…
https://nanti.jisuanke.com/t/31454 题意 两个人玩游戏,最初数字为m,有n轮,每轮三个操作给出a b c,a>0表示可以让当前数字加上a,b>0表示可以让当前数字减去b,c=1表示可以让当前数字乘-1,数字范围为[-100, 100],如果加/减出范围则直接等于边界,最终结果数字x>=R则为Good Ending,x<=L则为Bad Ending,否则Normal Ending,第一个人希望好结局,第二个人希望坏结局,如果没有办法就希望平局,每个人…
https://nanti.jisuanke.com/t/31462 题意 一个N*M的矩形,每个格点到其邻近点的边有其权值,需要构建出一个迷宫,使得构建迷宫的边权之和最小,之后Q次查询,每次给出两点坐标,给出两点之间的最短路径 分析 可以把每个格点视作视作图的点,隔开两点的边视作图的边,则构建迷宫可以视作求其生成树,剩余的边就是组成迷宫的墙.因为要花费最小,所以使删去的墙权置最大即可,呢么就是求最大生成树即可.然后每次查询相当于查这个最大生成树上任意两点的最短距离,到这一步就是个LCA了. 这…
https://nanti.jisuanke.com/t/31459 题意 n个矩阵,不存在包含,矩阵左下角都在(0,0),给右上角坐标,后来的矩阵会覆盖前面的矩阵,求矩阵周长. 分析 set按照x或者y从大到小排序,从后往前遍历,放入set,找到当前矩阵在set中的位置,当前矩阵的x或者y,与set中后一位矩阵的x或者y的差值,就是增加的横线或者竖线的长度 感觉套个线段树求周长的模板也行. #include<queue> #include<cstring> #include<…
https://nanti.jisuanke.com/t/31458 题意 有N个帧,每帧有K个动作特征,每个特征用一个向量表示(x,y).两个特征相同当且仅当他们在不同的帧中出现且向量的两个分量分别相等.求最多连续相同特征的个数? 分析 用一个map来维护帧中特征的信息,map中的键即读入的向量,因此用一个pair<int , int>表示. 键的值也是一个pair,需要记录它当前已经连续了多少次,还需要记录它上一次出现的帧的位置.如果它上一帧没有出现过,那么它的连续次数就要被置成1:如果上…
https://nanti.jisuanke.com/t/31460 题意 两个操作.1:查询区间[l,r]的和,设长度为L=r-l+1, sum=a[l]*L+a[l+1]*(L-1)+...+a[r].2:将第a个位置修改为b. 分析 变形一下,sum=a[l]*(r-l+1)+a[l+1]*(r-(l+1)-1)+...+a[r](r-r+1)=(r+1)*a[l]-a[l]*l.因此,可维护两个树状数组计算.至于更新操作,实质就是看变化前后的差值,变大就相当与加上差值,否则就是减.注意用…
https://nanti.jisuanke.com/t/31461 题意 一个hash规则,每个字母映射成一个两位数,求给的字符串最后的编码位数,要求去除最终结果的前导零 分析 按题意模拟就是了 #include <iostream> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main(){ int t,n,i,j,p,q,num; ch…
题目链接:Easy Math 题目大意:给定\(n(1\leqslant n\leqslant 10^{12}),m(1\leqslant m\leqslant 2*10^{9})\),求\(\sum_{i=1}^{m}\mu (i\cdot n)\). 题解:废话少说,直接上公式 $$\mu(i\cdot n)=\left\{\begin{matrix}\mu(i)\cdot\mu(n) & gcd(i,n)==1\\ 0 & other\end{matrix}\right.$$ 设 $…
赛后和队友讨论了一波,感谢无敌的队友给我细心的讲题 先埋坑 #include<iostream> #include<string.h> #include<algorithm> #include<stdio.h> using namespace std; ; ; int treex[maxx]; int treey[maxx]; ; int lowbit(int x){ return x&-x; } void add(int i,int x,int *…
题目链接: https://nanti.jisuanke.com/t/31459 具体思路: 先顺序输入,然后回溯,假设已经加入了n个点,那么在加入的同时,首先看一下原先x轴上已经有过的点,找到第一个最接近第n个点并且小于第n个点的坐标,y轴同理.如果没有找到,比如说第一个,那么他减去的就是0.然后再就是代码,如果用数组存储的话,每进入一个点都需要对原来的数组进行重新排序,然后再去查找所需的值,这样会超时.可以用set存储,每进入一个数都会进行重新排序,然后存储完之后,再对set进行二分查找,找…
There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ) means the wave is a rectangle whose vertexes are ( 00 , 00 ), ( xx , 00 ), ( 00 , yy ), ( xx , yy ). Every time the wave will wash out the trace of…