1 / 5
题目讲解
50 likes | 174 Vues
题目讲解. 1. 浏览器. 手动模拟栈的操作. 集合. 并查集的变化 新开节点来表示单个元素的移动. if(find(now[x])==find(now[y]))continue; id=find(now[x]); cnt[id]--; sum[id]-=x; now[x]=++n; set[n]=n; cnt[n]=1; sum[n]=x; U(now[x],now[y]);. 洗澡. 用堆(优先队列)维护洗澡间的使用情况. for(int i=0; i<n; i++) { int y; scanf("%d",&y);
Télécharger la présentation
题目讲解
An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.
Content is provided to you AS IS for your information and personal use only.
Download presentation by click this link.
While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
During download, if you can't get a presentation, the file might be deleted by the publisher.
E N D
Presentation Transcript
题目讲解 1
浏览器 手动模拟栈的操作
集合 并查集的变化 新开节点来表示单个元素的移动 if(find(now[x])==find(now[y]))continue; id=find(now[x]); cnt[id]--; sum[id]-=x; now[x]=++n; set[n]=n; cnt[n]=1; sum[n]=x; U(now[x],now[y]);
洗澡 用堆(优先队列)维护洗澡间的使用情况 for(int i=0; i<n; i++) { int y; scanf("%d",&y); int p=q.top(); q.pop(); q.push(p+y); } if(q.top()>600) printf("-1\n"); else printf("%d\n",q.top());
More Related