摘要: bfs最短路。 写的真丑。。。 #include #include #include #include #include using namespace std; const int maxn = 50; const int INF = 0x3f3f3f3f; const int dx[]={1,0,-1,0}; const int dy[]={0,1,0,-1}; int n,m,T... 阅读全文
posted @ 2016-05-30 17:49 invoid 阅读(124) 评论(0) 推荐(0) 编辑
摘要: hash 加上 平衡树(名次树)。 这道题麻烦的地方就在于输入的是一个名字,所以需要hash。 这个hash用的是向后探查避免冲突,如果用类似前向星的方式避免冲突,比较难写,容易挂掉,但也速度快些。 mod一定要取得大一些。 hash时要减去@,否则A和B的hash值会相同导致tle。 比较难写?//蒟蒻本性。。。 #include #include #include using ... 阅读全文
posted @ 2016-05-30 10:39 invoid 阅读(142) 评论(0) 推荐(0) 编辑