徐州网络赛F-Feature Trace【暴力】】的更多相关文章

Couple Trees Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/problemset/problem/1232 Description "Couple Trees" are two trees, a husband tree and a wife tree. They are named because they look like a couple leaning on each other.…
这个题,我也没想过我这样直接就过了 #include<bits/stdc++.h> using namespace std; ; typedef pair<int,int> pii; set<pii> G[maxn]; int main(){ int t,n,m,a,b,maxl; scanf("%d",&t); ;e<t;e++){ maxl=; ;i<maxn;i++)G[i].clear(); scanf("%d&…
2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution 将环变成链,设\(f[i][0\)~\(2]\),分别表示与第一个数相同,与第一个数不同,与第一个数相同,与第一个数的反相同.然后\(dp\)即可. 时间复杂度:\(O(n)\) B. BE, GE or NE solution 根据题目描述\(dp\)即可. 时间复杂度:\(O(nm)\) C.…
ICPC 2019 徐州网络赛 比赛时间:2019.9.7 比赛链接:The Preliminary Contest for ICPC Asia Xuzhou 2019 赛后的经验总结 // 比赛完才反应过来没看完全部题, J题树形dp没写太亏了... // 几何旋律AK了,太强了Orz // 虽然我们队A了8题,但如果时间分配好,认真读题避免看错题的话,应该至少多A一题 A. Who is better? 题意 两个人玩游戏,谁先消灭完敌人就赢.两条规则:1. 第一个人不能全部消灭完: 2.…
query Given a permutation pp of length nn, you are asked to answer mm queries, each query can be represented as a pair (l ,r )(l,r), you need to find the number of pair(i ,j)(i,j) such that l \le i < j \le rl≤i<j≤r and \min(p_i,p_j) = \gcd(p_i,p_j )…
ACM-ICPC 南昌网络赛F题 Megumi With String 题目描述 给一个长度为\(l\)的字符串\(S\),和关于\(x\)的\(k\)次多项式\(G[x]\).当一个字符串\(str\)是S的子串时,定义\(str\)的\(value\)值为\(G[length(str)]\),否则\(value=0\).一个字符串的\(power\)值定义为其所有子串的\(value\)之和.每次向\(S\)末尾添加一个字符,重复\(m\)次.求每次添加字符后,一个长度为\(n\)的随机串\…
[徐州网络赛]Longest subsequence 可以分成两个部分,前面相同,然后下一个字符比对应位置上的大. 枚举这个位置 用序列自动机进行s字符串的下标转移 注意最后一个字符 #include <bits/stdc++.h> const int maxn = 1e6 + 7; using namespace std; #define ll long long int n, m; char s[maxn], t[maxn]; int nex[maxn][27]; void init()…
题目链接:哈哈哈哈哈哈 _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ 哈哈哈哈哈哈,从9月16日打了这个题之后就一直在补这道题,今天终于a了,哈哈哈哈哈哈. 先把代码贴上,有时间再好好写题解,哈哈哈哈哈哈. ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ 代码,嘻嘻: #include<bits/stdc++.h> using namespace std; typedef long long ll…
哈哈哈哈哈哈哈哈哈哈哈哈,终于把这道题补出来了_(:з」∠)_ 来写题解啦. _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ 哈哈哈哈哈哈,从9月16日打了这个题之后就一直在补这道题,今天终于a了,哈哈哈哈哈哈. 先把代码贴上,有时间再好好写题解,哈哈哈哈哈哈.ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ヾ(◍°∇°◍)ノ゙ 代码,嘻嘻: #include<bits/stdc++.h> using namespace…
"Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up sev…
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 <xx, yy>. If x_ixi​= x_jxj​ and y_iy…
题意:n个左下角为原点右上角在第一象限的矩形不断覆盖,求最后形成的图形的周长 x和y是独立的,分别维护两棵线段树,一棵表示x坐标下最大的y值,另一棵表示y坐标下最大的x值 从覆盖的角度来考虑,如果逆序处理,当前处理的段的贡献为大于等于当前位置的最大值的差 比如一条横的线段i,坐标为[x1=0,x2],y 那它对答案的贡献为max(0,x2 - max_x of [y,maxy]),此时的区间存在的线段为逆序第n条到第i+1条 处理完后再插入到对应的线段树中即可(其实贡献为0的不插也行,因为都是不…
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…
Features Track 31.32% 1000ms 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 vecto…
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…
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 N guests Reimu serv…
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 height of the rectangle is NN and the width of the rectang…
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…
54.19% 2000ms 262144K Morgana is playing a game called cacti lottery. In this game, morgana has a 3 \times 33×3 grid graph, and the graph is filled with 11 ~ 99 , each number appears only once. The game is interesting, he doesn't know some numbers, b…
BE, GE or NE 23.58% 1000ms 262144K   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…
Hard to prepare 28.63% 1000ms 262144K   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…
F. The Answer to the Ultimate Question of Life, The Universe, and Everything. 我的第一道真·打表题 这次是真的打表啊,不是初始化求值! 重现赛的时候,一直在搞在线的做法,map和unordered_map都上了,都是TLE,初始化建立两个map,然后枚举a,b再找是否有c,我算的复杂度也就  O(T*5000*10000/2)?  2e8?好像确实得T.实际复杂度或许更高 ? unordered_map内部哈希表实现,…
题意:f(i)=i的幂次之和. 求(N+1-i)*f(i)之和. 思路:可以推论得对于一个素数p^k,其贡献是ans=(N+1)[N/(P^k)]+P^k(1+2+3...N/(P^k)); 我们分两部分统计答案即可,在p<=sqrt(N)时,可以暴力(阶乘那样一直除)统计答案. p>sqrt(N)时,我们可以利用min25的消息得到. 因为p>sqrt(N),这个时候k=1,所以贡献为(N+1)*(N/p)+p*(1+2+...N/p):我们把N/p相同的拉出来即可,而这个东西正好就是…
给两颗标号从1...n的树,保证标号小的点一定在上面.每次询问A树上的x点,和B树上的y点同时向上走,最近的相遇点和x,y到这个点的距离. 比赛的时候想用倍增LCA做,但写渣了....后来看到题解是主席树就写了一发 呆马: #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vecto…
/* 将给定的一个字符串分解成ABABA 或者 ABABCAB的形式! 思路:暴力枚举A, B, C串! */ 1 #include<iostream> #include<cstring> #include<cstdio> #include<string> using namespace std; string str; ]; int main(){ int t; scanf("%d", &t); getchar(); while…
题意:给出一个字符串,长度是2*10^4.将它首尾相接形成环,并在环上找一个起始点顺时针或逆时针走一圈,求字典序最大的走法,如果有多个答案则找起始点最小的,若起始点也相同则选择顺时针. 分析:后缀数组. 首先,需要补充后缀数组的基本知识的话,看这个链接. http://www.cnblogs.com/rainydays/archive/2011/05/09/2040993.html 我利用这道题重新整理了后缀数组的模板如下: ; //call init_RMQ(f[], n) first. //…
"Couple Trees" are two trees, a husband tree and a wife tree. They are named because they look like a couple leaning on each other. They share a same root, and their branches are intertwined. In China, many lovers go to the couple trees. Under t…
f(cos(x))=cos(n∗x) holds for all xx. Given two integers nn and mm, you need to calculate the coefficient of x^mx​m​​ in f(x)f(x), modulo 998244353998244353. Input Format Multiple test cases (no more than 100100). Each test case contains one line cons…
自己太菜,数学基础太差,这场比赛做的很糟糕.本来想吐槽出题人怎么都出很数学的题,现在回过头来想还是因为自己太垃圾,竞赛就是要多了解点东西. 找$f(cos(x))=cos(nx)$中$x^m$的系数模998244353. wolfram alpha查了这个函数无果,得到了一堆sinx和cosx以及一个复指数的方程,其实应该推个几项再用数列查询查查看的,然后就会知道是Chebyshev polynomials 查WIKI直接就有通项公式了.然后就比较简单的了. 连方程都看不出来就别想着推导公式了.…
题目链接: https://nanti.jisuanke.com/t/31458 题解: 建立两个树状数组,第一个是,a[1]*n+a[2]*(n-1)....+a[n]*1;第二个是正常的a[1],a[2],a[3]...a[n] #include "bits/stdc++.h" using namespace std; #define ll long long const int MAXN=1e5+10; ll sum[MAXN],ans[MAXN]; ll num[MAXN];…