随笔分类 - JSOI
摘要:首先必须知道这样一个性质:同一个图的所有最小生成树等权值的边的数量相等、那么我们先求任意的一个MST、得到每个权值出现的次数(这里可以先离散化方便处理)、然后根据题目所给的很好的性质(每个权值出现不超过10次)、对每个权值用2^10枚举取边的情况、然后再看是否还存在一棵MST、复杂度大概是不到2^10*M*M/10的、、Code:#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cmath>#include <c
阅读全文
摘要:除草向、裸SA、处理环的话就复制一遍挂在后面就好了、Code:const maxm=400001;var ch:char; s,trk,rank,sa,tsa,sum:array [0..500001] of longint; len,i,j,p,got:longint;begin {assign(input,'cipher.in'); assign(output,'cipher.out'); reset(input); rewrite(output); } len:=0; while not eoln do begin read(ch); inc...
阅读全文
摘要:想法其实是挺巧妙的。。找到所有数的所有因数,统计最大的一个出现过K次的因数。Code:#include <cstdio>#include <iostream>using namespace std;long a[1001];long s[1000001];long gcd(long a,long b){ if (a%b==0) { return b; } if (b%a==0) { return a; } return gcd(b,a%b);}void qqsort(long l,long r){ long i=l,j=r,x; x=s[(l+r)/2]; /*cout
阅读全文

浙公网安备 33010602011771号