首页 > 其他 > 详细

終極の図

时间:2017-12-05 00:17:30      阅读:264      评论:0      收藏:0      [点我收藏+]

终极图模板

好了,这可能是终极的图模板了。

struct Graph{
    struct Edge{
        int to, next; Graph *bel;
        inline int operator *(){ return to; }
        Edge& operator ++(){
            return *this=bel->edge[next]; }
    };
    void addedge(int x, int y){
        Edge &e=edge[++cntedge];
        e.to=y; e.next=fir[x];
        fir[x]=cntedge; e.bel=this;
    }
    void reset(){
        cntedge=0; memset(fir, 0, sizeof(fir)); }
    Edge& getlink(int x){
        return edge[fir[x]]; }
    Edge edge[maxm*2];
    int cntedge, fir[maxn];
}g;

(日文不懂装懂)

終極の図

原文:http://www.cnblogs.com/MyNameIsPc/p/7979688.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!