版本比较
题解 P8330 [ZJOI2022] 众数
正文
增加 2 行删除 2 行
56 行未改动5758596061616263646553 行未改动11912012112212312312412512612717 行未改动56 行未改动 n=read(); for (int i=1;i<=n;i++) b[i].id=i,b[i].x=read(); sort(b+1,b+n+1,cmp); m=0; int gp=0; int gp=0; for (int i=1;i<=n;i++) { if (i==1||b[i].x!=b[i-1].x) c[++m]=b[i].x; a[b[i].id]=m;53 行未改动 while (tot<col[u]&&p>g[u][tot]) tot++; ans[u]=max(ans[u],k+col[u]-(res-tot)); res++; } if (pre[n]!=-1) if (pre[n]!=-1) { int p=pre[n]; while (tot<col[u]&&p>g[u][tot]) tot++; ans[u]=max(ans[u],k+col[u]-(res-tot));17 行未改动