亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

poj 2367 拓撲排序

2019-11-11 04:10:29
字體:
來源:轉載
供稿:網友

The system of Martians’ blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Martian can have one parent as well as ten. Nobody will be surPRised by a hundred of children. Martians have got used to this and their style of life seems to them natural. And in the Planetary Council the confusing genealogical system leads to some embarrassment. There meet the worthiest of Martians, and therefore in order to offend nobody in all of the discussions it is used first to give the floor to the old Martians, than to the younger ones and only than to the most young childless assessors. However, the maintenance of this order really is not a trivial task. Not always Martian knows all of his parents (and there’s nothing to tell about his grandparents!). But if by a mistake first speak a grandson and only than his young appearing great-grandfather, this is a real scandal. Your task is to write a program, which would define once and for all, an order that would guarantee that every member of the Council takes the floor earlier than each of his descendants. Input The first line of the standard input contains an only number N, 1 <= N <= 100 — a number of members of the Martian Planetary Council. According to the centuries-old tradition members of the Council are enumerated with the natural numbers from 1 up to N. Further, there are exactly N lines, moreover, the I-th line contains a list of I-th member’s children. The list of children is a sequence of serial numbers of children in a arbitrary order separated by spaces. The list of children may be empty. The list (even if it is empty) ends with 0. Output The standard output should contain in its only line a sequence of speakers’ numbers, separated by spaces. If several sequences satisfy the conditions of the problem, you are to write to the standard output any of them. At least one such sequence always exists. Sample Input 5 0 4 5 1 0 1 0 5 3 0 3 0 Sample Output 2 4 5 3 1 又長又臭的題目:每一行給幾個數,要求行序號在這些數前面。證明這幾個數一定要在行序號出現后再出現,拓撲排序

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;const int maxn = 101000;#define inf 0x3f3f3f3fint e[1010][1010];int in[1010];int res[1010];int main(){ int n; while(cin>>n) { int tot=0; memset(in,0,sizeof(in)); memset(e,0,sizeof(e)); for(int i=1;i<=n;i++) { int x; while(cin>>x&&x) { e[i][x]=1; in[x]++; } } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(!in[j]) { res[tot++]=j; in[j]=-1; for(int k=1;k<=n;k++) { if(e[j][k]) in[k]--; } break; } } } printf("%d",res[0] ); for(int i=1;i<tot;i++) { printf(" %d",res[i] ); } printf("/n"); }}
上一篇:vim基礎學習

下一篇:MST唯一性判斷

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品久久久久久久7电影| 奇米影视亚洲狠狠色| 亚洲激情 国产| 亚洲视频一区二区三区| 91经典在线视频| 久久九九精品99国产精品| 91精品国产成人| 亚洲美女av在线播放| 国产精品手机播放| 91sa在线看| 日韩av中文在线| 国产精品午夜国产小视频| www.欧美精品| 欧美老肥婆性猛交视频| 亚洲免费av片| 亚洲国产97在线精品一区| 成人福利视频在线观看| 成人国产精品久久久| 久久亚洲精品一区| 91青草视频久久| 国产不卡精品视男人的天堂| 狠狠色狠色综合曰曰| 国产精品狼人色视频一区| 亚洲美女视频网| 久久韩国免费视频| 国产在线拍揄自揄视频不卡99| 亚洲a∨日韩av高清在线观看| 久久久亚洲福利精品午夜| 日韩欧美国产成人| 久久久久一本一区二区青青蜜月| 俺去啦;欧美日韩| 欧美在线观看一区二区三区| 91九色视频导航| 欧美精品福利视频| 久久久久久久久国产精品| 青草成人免费视频| 久久亚洲精品网站| 2019中文字幕在线免费观看| 91黑丝在线观看| 欧美激情视频给我| 青青久久aⅴ北条麻妃| 91大神在线播放精品| 日韩精品亚洲视频| 亚洲国产黄色片| 亚洲精品美女免费| 91网在线免费观看| 欧美极品少妇xxxxx| 成人国产精品色哟哟| 亚洲品质视频自拍网| 亚洲国内精品在线| 日韩在线视频免费观看高清中文| 国语自产精品视频在线看抢先版图片| 国产美女高潮久久白浆| 91精品国产91久久| 97精品伊人久久久大香线蕉| 精品国偷自产在线视频99| 国产精品日日摸夜夜添夜夜av| 国产免费一区二区三区在线能观看| 疯狂做受xxxx高潮欧美日本| 欧美成人在线网站| 亚洲精品国产欧美| 深夜福利国产精品| 欧美成人sm免费视频| 俺去了亚洲欧美日韩| 久久国产精品久久国产精品| 久久久久久久香蕉网| 欧美成人精品在线播放| 国产91成人在在线播放| 精品国产视频在线| 中文字幕亚洲欧美日韩在线不卡| 国产精品入口夜色视频大尺度| 久久久久久久久久久网站| 国产精品电影观看| 中文字幕欧美视频在线| 久久久久国产视频| 欧美劲爆第一页| 69av视频在线播放| 色综合色综合网色综合| 欧美黑人狂野猛交老妇| 日韩网站免费观看高清| 成人中文字幕+乱码+中文字幕| 日本精品视频在线| 欧美日韩高清在线观看| 91久久久久久久久久久| 国产精品美乳一区二区免费| 亚洲成人性视频| 欧美肥臀大乳一区二区免费视频| 欧美在线xxx| 国产精品久久久久久av福利软件| 国产精品成人aaaaa网站| 国产97人人超碰caoprom| 456亚洲影院| 国产精品久久久精品| 亚洲视频777| 久久久久亚洲精品成人网小说| 欧美日韩国产中文精品字幕自在自线| 亚洲福利视频专区| 成人啪啪免费看| 久久精品99久久久久久久久| 亚洲一区二区少妇| 成人a在线视频| 国产精品美女午夜av| 在线观看欧美日韩国产| 人妖精品videosex性欧美| 日韩亚洲国产中文字幕| 国产欧美日韩丝袜精品一区| 亚洲欧洲日产国产网站| 国产美女久久久| 4438全国成人免费| 精品久久久久久久中文字幕| zzjj国产精品一区二区| 国产亚洲一区二区在线| 欧美日韩国产精品| 日本高清+成人网在线观看| 最近2019中文字幕一页二页| 日韩成人在线免费观看| 欧美激情免费视频| 亚洲欧美日韩综合| 亚洲人成欧美中文字幕| 欧美色xxxx| 欧美一性一乱一交一视频| 国产中文字幕亚洲| 91色视频在线观看| 欧美日韩国产91| 久久国产精品电影| 亚洲网站视频福利| 欧美黄色性视频| 一区二区欧美日韩视频| 日韩视频免费在线| 国产欧美在线视频| 欧美天堂在线观看| 国产区亚洲区欧美区| 日韩在线观看免费av| 亚洲精品久久久久国产| 欧美性做爰毛片| 国产日韩视频在线观看| 久久久精品一区二区三区| 亚州av一区二区| 91精品国产乱码久久久久久蜜臀| 久久久久国色av免费观看性色| 午夜精品久久久久久99热软件| 91精品国产综合久久香蕉922| 国产精品偷伦视频免费观看国产| 中文国产成人精品久久一| 久久久噜噜噜久久久| 欧美成人激情视频免费观看| 久久久www成人免费精品| 久热精品视频在线| 久久久91精品国产| 亚洲国产成人精品一区二区| 日本精品视频在线播放| 91色精品视频在线| 欧美国产日韩视频| 国产精品69久久久久| 亚洲一区二区国产| 最近2019年中文视频免费在线观看| 91精品国产色综合久久不卡98口| 欧美成aaa人片在线观看蜜臀| 欧美高清自拍一区| 欧美精品久久久久久久| 欧美亚洲一级片| 欧洲永久精品大片ww免费漫画| 欧美成人精品一区二区三区| 日韩精品视频免费|