//标准的层次遍历模板 //居然因为一个j写成了i,debug半天.....解题前一定要把结构和逻辑想清楚,不能着急动手,理解清楚题意,把处理流程理清楚再动手,恍恍惚惚的写出来自己慢慢debug吧 #include<cstdio>#include<vector>#include<queue>#include<algorithm>using namespace std;const int maxn=1001;struct node{ int level; ve…
题目大意:给出每个用户id关注的人,和转发最多的层数L,求一个id发了条微博最多会有多少个人转发,每个人只考虑转发一次.用BFS,同时每个节点要记录下所在的层数,由于只能转发一次,所以每个节点要用vis判断之前是否入过队列,不能重复入队. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include…
使用DFS出现超时,改成bfs DFS #include <iostream> #include <vector> #include <set> using namespace std; int n; int l; int i,j; int m,k; int follower[1001][1001]; vector<int> user_list[1001]; set<int> user_s; void queryU(int a,int depth…
1076 Forwards on Weibo (30分)   Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post o…
1076 Forwards on Weibo (30)(30 分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a pos…
PAT甲级1076. Forwards on Weibo 题意: 微博被称为中文版的Twitter.微博上的一位用户可能会有很多关注者,也可能会跟随许多其他用户.因此,社会网络与追随者的关系形成.当用户在微博上发布帖子时,他/她的所有跟随者可以查看和转发他/她的帖子,然后可以由他们的追随者再次转发. 现在给出一个社交网络,假定只计算间接跟随者的L个级别,您应该计算任何特定用户的最大潜在潜在金额. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第一行包含2个正整数:N(<= 1000),…
1076 Forwards on Weibo (30 分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on…
Source: PAT A1076 Forwards on Weibo (30 分) Description: Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. W…
http://acm.hdu.edu.cn/showproblem.php?pid=5012 Problem Description There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face,…
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonal…