[luoguP3068] [USACO13JAN]派对邀请函Party Invitations(stl大乱交)


传送门

记录每一个编号在那些组中,可以用vector,这里选择链式前向星。

每一组用set

将被邀请的放到queue中

#include <set> #include <queue> #include <cstdio> #include <cstring> #include <iostream> #define N 1000001 using namespace std; int n, g, cnt, ans; int head[N], to[N], next[N]; queue <int> q; set <int> s[N]; set <int> :: iterator it; bool b[N]; inline int read() inline void add(int x, int y) int main() } q.push(1); while(!q.empty()) } } printf("%d\n", ans); return 0; }

  



上一篇:[HDU2157]How many ways??(DP + 矩阵优化)

下一篇:【模板】manacher算法


stl
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图