### 代码

#include
#define maxn 500500
#define md 998244353
#define ll long long
using namespace std;
struct Edge{
int to,next;
Edge(int a=0,int b=0){
to=a,next=b;
}
}l[maxn<<1];
int pre[maxn],deg[maxn],inv[maxn],chain,ans,X,Y,S;
void Init(){
inv[1]=1;
for (register int i=2;i<=n;++i)
inv[i]=(1ll*(md-md/i)*inv[md%i]%md+md)%md;
}
}
void Dfs(int u,int fa,int dis){
if (dis>chain) chain=dis,nod=u;
int v=l[i].to;
if (v==fa) continue;
pre[v]=u,Dfs(v,u,dis+1);
}
}
void Sum(int u,int fa,int dis){
if (dis==chain/2) tot++;
for (register int i=1,a,b;i
 
 Share Show Comments 【CodeForces 886F】Symmetric Projections / 题解 题目描述 给定一个二维平面的点集。一条经过原点的直线被称作好的直线，当且仅当点集内每个点到这条直线的投影呈中心对称。请找出好的直线的总条数。 输入 第一行输入点集大小 $n \ (1\leq n\leq… 06 Nov 2018 【BZOJ 5092】[Lydsy 1711 月赛] 分割序列 / 题解 题目描述 对于一个长度为$n$的序列$s$，定义函数$$f(s)=\max \lbrace (s_1… 05 Nov 2018       Topics Thought: 30 Study: 26 Selected: 26 Zepto's © 2022 Sponsor Data & privacy Contact → Published with Ghost • Theme Attila • System theme  $(document).ready(function () { var viewport = $(window); var post =$('.post-content'); // Responsive videos with fitVids post.fitVids(); // Format code blocks and add line numbers function codestyling() { $('pre code').each(function(i, e) { // Code highlight hljs.highlightBlock(e); // No lines for plain text blocks if (!$(this).hasClass('language-text')) { var code = $(this); // Calculate amount of lines var lines = code.html().split(/\n(?!$)/g).length; var numbers = []; if (lines > 1) { lines++; } for (i = 1; i < lines; i++) { numbers += '<span class="line" aria-hidden="true">' + i + '</span>'; } code.parent().append('<div class="lines">' + numbers + '</div>'); } }); } codestyling(); // Reading progress bar on window top function readingProgress() { var postBottom = post.offset().top + post.height(); var viewportHeight = viewport.height(); var progress = 100 - (((postBottom - (viewport.scrollTop() + viewportHeight) + viewportHeight / 3) / (postBottom - viewportHeight + viewportHeight / 3)) * 100); $('.progress-bar').css('width', progress + '%'); (progress > 100) ?$('.progress-container').addClass('complete'): $('.progress-container').removeClass('complete'); } readingProgress(); // Trigger reading progress viewport.on({ 'scroll': function() { readingProgress(); }, 'resize': function() { readingProgress(); }, 'orientationchange': function() { readingProgress(); } }); // Check if disqus is defined by code injection if (typeof disqus === 'undefined') { // hide comment section$('.post-comments').css({ 'display': 'none' }); } else { $('#show-disqus').on('click', function() {$.ajax({ type: "GET", url: "//" + disqus + ".disqus.com/embed.js", dataType: "script", cache: true }); \$(this).parent().addClass('activated'); }); } });