题目传送门:http://codeforces.com/contest/1119/problem/D D. Frets On Fire time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Miyako came to the flea kingdom with a ukulele. She became good friend…
题目分析: 用"$"连接后缀数组,然后做一个主席树求区间内不同的数的个数.二分一个前缀长度再在主席树上求不同的数的个数. 代码: #include<bits/stdc++.h> using namespace std; ; ; int m,n,k; string hmk[maxn],str; int sum[maxn]; int sa[maxn],rk[maxn],X[maxn],Y[maxn]; ],Tnum; long long ans[maxn]; struct no…
Description A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subsequence of consecutive elements o…
本题题意:在一个矩阵中,去随机一点,设定一个步数K,求出从这个点可以走到的范围的和,求最大值 思路:这个范围的和是一个菱形,我们把他旋转45°,然后成为一个正放的矩阵,求出二维前缀和 然后用前缀和的性质枚举每一块矩阵的大小,更新答案 #include<cstdio> #include<algorithm> using namespace std; ; int a[maxn][maxn]; ][maxn*]; int main() { int n,m,k,x,y,xl,yl,xr,y…
Description You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quickly k-th order statistics in the array…