179 条题解

  • 0
    @ 2009-09-25 14:00:25

    Toposort + floodfill, The data is so weak that I didn't need to consider the situation of cirles.

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-09-20 16:16:27

    const maxn=200;

    type re=record o,l:integer; q:array[1..maxn]of integer; end;

    var a:array[1..maxn,0..maxn]of integer;

      b:array[1..maxn]of boolean;

      c:array[1..maxn]of re;

      cc:re;

      n,i,j,x,w,o:integer;

    procedure bfs(x:integer);

    var b:array[1..maxn]of boolean;

      q:array[1..maxn]of integer;

      i,f,r,o:integer;

    begin

    f:=0; r:=1; q[1]:=x;

    for i:=1 to n do b[i]:=true;

    b[x]:=false;

    while f

  • 0
    @ 2009-09-20 15:25:07

    BFS就行了

    const maxn=200;

    type re=record o,l:integer; q:array[1..maxn]of integer; end;

    var a:array[1..maxn,0..maxn]of integer;

    b:array[1..maxn]of boolean;

    c:array[1..maxn]of re;

    cc:re;

    n,i,j,x,w,o:integer;

    procedure bfs(x:integer);

    var b:array[1..maxn]of boolean;

    q:array[1..maxn]of integer;

    i,f,r,o:integer;

    begin

    f:=0; r:=1; q[1]:=x;

    for i:=1 to n do b[i]:=true;

    b[x]:=false;

    while f

  • 0
    @ 2009-09-13 13:52:25

    用深搜就行了,不过得注意环!

    var

    s1,arr1:array[1..200]of boolean;

    arr:array[1..200,1..200]of integer;

    a,b,n,tm,men:integer;

    s:array[1..200]of integer;

    procedure find(i:integer);

    var p:integer;

    begin

    if(s1[i])and(arr1[i])then begin

    s1[i]:=false;if(tm>1)then arr1[i]:=false;

    if(s[i]>0)then begin

    for p:=1 to s[i] do begin

    if(s1[arr])and(arr1[arr])then begin

    tm:=tm+1;

    find(arr);

    end;

    end;

    end;

    end;

    end;

    begin

    read(n);

    fillchar(arr1,sizeof(arr1),true);

    for a:=1 to n do begin

    b:=0;

    while true do begin

    read(arr[a,b+1]);

    if(arr[a,b+1]=0)then begin s[a]:=b;break;end

    else b:=b+1;

    end;

    end;

    for a:=1 to n do begin

    fillchar(s1,sizeof(s1),true);

    tm:=1;

    find(a);

    end;

    for a:=1 to n do

    if(arr1[a])then inc(men);

    writeln(men);

    end.

  • 0
    @ 2009-09-12 17:15:22

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    以前都用的DFS,晕啊,FLOYED也行啊!收缩强连通分量才是正解吧!

  • 0
    @ 2009-09-12 09:43:04

    好多人用集合啊……

    算算看,我自从我第一次接触OI已经5+年了,几乎都没有怎么写过集合,而且一直是菜鸟。有很多同仁,学OI才2年3年,都拿了IOI金牌银牌。

    我还算是个人么?我还算是正常人么?

    忘记了这一切,也就忘记了全部。

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    const filename='p1023';

    var

    a:array[1..200,1..200]of boolean;

    f:array[1..200]of boolean;

    k,j,i,n,x,ans:longint;

    begin

    assign(input,filename+'.in');reset(input);

    assign(output,filename+'.out');rewrite(output);

    readln(n);

    for i:=1 to n do

    repeat

    read(x);

    if (x0)then a:=true;

    until(x=0);

    for k:=1 to n do

    for i:=1 to n do

    for j:=1 to n do

    if aand a[k,j] then a:=true;

    ans:=0;

    for i:=1 to n do

    if not(f[i])then

    begin

    for j:=1 to n do

    if aand a[j,i]then f[j]:=true;

    inc(ans);

    f[i]:=true;

    end;

    writeln(ans);

    close(input);close(output);

    end.

    弹头:

    弯成一弯的桥梁倒映在这湖面上

    你从那头瞧这看月光下一轮美满

    青石板的老街上你我走过的地方

    那段斑驳的砖墙如今到底啥模样

    到不了的都叫做远方

    回不去的名字叫家乡

    lara+弹头:

    呜~

    谁在门外唱那首牡丹江

    我聆听感伤你声音悠扬

    风铃摇晃清脆响

    江边的小村庄午睡般安祥

    谁在门外唱那首牡丹江

    我脚步轻响走向你身旁

    思念的光透进窗

    银白色的温暖洒在儿时的床

    lara:

    牡丹江弯了几个弯小鱼儿甭上船咱们不稀罕

    捞月亮张网补星光给爷爷下酒喝一碗家乡

    牡丹江弯了几个弯小虾米甭靠岸咱们没空装

    捞月亮张网补星光给姥姥熬汤喝一碗家乡

  • 0
    @ 2009-09-06 11:34:47

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    此题太水 难度3的大肥肉被我捡到了。。

  • 0
    @ 2009-09-01 09:54:34

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    人品大爆发......

  • 0
    @ 2009-08-25 15:41:35

    囧了 我交了2的程序 AC了

  • 0
    @ 2009-08-21 16:11:57

    这2题相通的阿..

  • 0
    @ 2009-08-19 14:13:08

    和前一题一样的程序都AC~

    略微有一点点冷~

  • 0
    @ 2009-08-18 18:30:05

    program p1023(input,output);

    type state=set of 1..200;

    var

    f:array[1..200] of state;

    i,j,n,m,k:integer;

    begin

    readln(n);

    for i:=1 to n do f[i]:=[i];

    for i:=1 to n do

    begin

    while true do

      begin

       read(j);

       if j=0 then begin readln; break; end;

       f[i]:=f[i]+[j];

      end;

    end;

    for i:=1 to n do

    for j:=1 to n do

    begin

      if i in f[j] then f[j]:=f[i]+f[j];

      if j in f[i] then f[i]:=f[i]+f[j];

    end;

    for i:=1 to n do

    for j:=1 to n do

    begin

      if (f[j]

  • 0
    @ 2009-08-15 20:46:16

    #include

    using namespace std;

    ifstream fin("a.in");

    ofstream fout("a.out");

    int c[201][201]={0},n,m,b[201];

    bool d[201];

    int dfs(int i,int k)

    {

    for(int j=1;j>n;

    memset(d,false,sizeof(d[0]));

    for(i=1;i>x;

    while(x!=0)

    {

    c[i][x]=1;

    fin>>x;

    }

    }

    for(j=1;j

  • 0
    @ 2009-08-06 23:47:26

    确实不得不承认

    1022和1023

    AC代码是基本互通的。。。。

  • 0
    @ 2009-08-05 14:05:35

    我把1022直接粘过来就ac了

  • 0
    @ 2009-08-01 11:05:03

    把1022的稍微改了一下。。一次ac。。强联通缩点才是正解吧。。正解才是王道。。

  • 0
    @ 2009-07-31 14:52:16

    数据果然弱,用1022的程序都能过,明明就不一样,结果又那么多人出来误导。。

  • 0
    @ 2009-07-31 11:58:10

    var

    vis :array[0..200]of boolean;

    f :array[0..200,0..200]of boolean;

    n,i,j,k,tot,x :integer;

    begin

    read(n);

    fillchar(f,sizeof(f),false);

    fillchar(vis,sizeof(vis),false);

    for i:=1 to n do

    begin

    read(x);

    while x>0 do

    begin

    f:=true;

    read(x);

    end;

    end;

    for k:=1 to n do

    for i:=1 to n do

    if (ik)and(f) then

    for j:=1 to n do

    if (jk)and(ji)and(not f)then

    f:=f[k,j];

    tot:=0;

    for i:=1 to n do

    if not vis[i] then

    begin

    for j:=1 to n do

    if fand f[j,i] then vis[j]:=true;

    inc(tot);

    vis[i]:=true;

    end;

    writeln(tot);

    end.

  • 0
    @ 2009-07-28 20:18:09

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

信息

ID
1023
难度
4
分类
图结构 | 强连通分量 点击显示
标签
递交数
4310
已通过
1967
通过率
46%
被复制
12
上传者