题解

116 条题解

  • 0
    @ 2008-11-13 11:18:13

    負數出現確認。

    單層可能確認。

    完全模擬可能。

    陰人的 = =

    注意結果開Longint...

  • 0
    @ 2008-11-12 10:26:29

    输入层的ci 不用减 ui `\

  • 0
    @ 2008-11-08 15:52:57

    编译通过...

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

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

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

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

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

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

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

  • 0
    @ 2008-11-07 07:04:06

    题目出得太隐晦

    看懂后,宽搜AC之

  • 0
    @ 2008-11-06 19:16:18

    题目描述害人。

    Ci>0才处理,输出。

    BFS也可做

  • 0
    @ 2008-11-06 15:12:32

    fuck 了 输出要求CI>0 早知道先看题解了。。。

  • 0
    @ 2008-11-06 14:51:56

    编译通过...

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

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

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

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

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

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

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

  • 0
    @ 2008-11-06 11:31:41

    const maxn=201;

    var ti,i,k,t,n,p,a,b:longint;

    f:boolean;

    c,u,x,y,id,od:array[0..maxn]of longint;

    check:array[0..maxn]of boolean;

    w:array[0..maxn,0..maxn]of longint;

    begin

    assign(input,'network.in');

    reset(input);

    assign(output,'network.out');

    rewrite(output);

    readln(n,p);

    for i:=1 to n do

    begin

    read(c[i],u[i]);

    end;

    fillchar(id,sizeof(id),0);

    fillchar(od,sizeof(od),0);

    filldword(w,sizeof(w) shr 2,maxlongint);

    for i:=1 to p do

    begin

    read(a,b);

    read(w[a,b]);

    inc(od[a]);

    inc(id);

    end;

    fillchar(check,sizeof(check),true);

    for i:=1 to n do

    begin

    if id[i]=0 then check[i]:=false;

    end;

    ti:=0;

    while true do

    begin

    f:=true;

    for i:=1 to n do if id[i]=0 then begin k:=i;f:=false;break;end;

    if f then break;

    if check[i] then c[k]:=c[k]-u[k];

    id[k]:=-1;

    if (od[k]=0) and (c[k]0) then

    begin

    inc(ti);

    x[ti]:=k;

    y[ti]:=c[k];

    end;

    if c[k]>0 then

    begin

    for i:=1 to n do

    if (w[k,i]0) then

    begin

    c[i]:=c[i]+w[k,i]*c[k];

    dec(id[i]);

    end;

    end;

    end;

    if ti=0 then writeln('NULL')

    else for i:=1 to ti do writeln(x[i],' ',y[i]);

    close(input);

    close(output);

    end.

    哪有错?

  • 0
    @ 2008-11-04 00:19:13

    竟然数据会有负值,害我交3次60分

  • 0
    @ 2008-10-31 19:40:11

    编译通过...

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

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

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

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

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

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

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

    其实真的不用TOPO。

    用D=0表示这个点尚未传到;

    用D=1表示这个点正要处理;

    用D=2表示这个点已经搞定;

  • 0
    @ 2008-10-28 23:38:59

    水,竟然没看到输出null时不用加编号.....不然早1次ac

  • 0
    @ 2008-10-25 09:34:48

    最后一组数据特殊情况

    1 0

    2 10

    。。。骗过了。。。汗。。。。。。

  • 0
    @ 2008-10-16 12:56:12

    为什么都说是拓扑排序呢?其实不用任何算法,模拟就可以过呀!

  • 0
    @ 2008-10-11 18:11:45

    队列,模拟,之后就是

    编译通过...

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

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

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

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

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

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

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

    MMD 这样的题好做不好读,差点又把脑壳读昏了。。。

    做了2年的老水题。。。。

  • 0
    @ 2008-10-07 09:24:18

    编译通过...

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

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

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

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

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

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

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

    算法:topo排序。

    题目的描述存在缺陷,题目要求输出非0点,但输出时只可以输出大于0的点,否则第2个点错误。

  • 0
    @ 2008-09-30 12:59:18

    数据非常弱...............

    但是注意一点:边权可以是0.

  • 0
    @ 2008-09-18 15:41:36

    这个题目告诉我,要认真看题,下面这个语句,找了N半天才发现错了...

    if sj[t].c

  • 0
    @ 2008-08-13 03:18:28

    首先,使用TOP排序,直接往后累加

    最好使用邻接表。

    另外,题目中所指的非0其实是大于0

  • 0
    @ 2008-07-29 21:25:24

    我彻彻底底地成神经病了,看个题目看了快1个小时才开始写.

    还不如直接写图论问题......

    这样还必要容易明白

    搞的我一开始还以为是直接带公式呢.

  • 0
    @ 2007-12-19 14:29:48

    我再一次地、强烈地提醒一下:输出的c[i]是要大于零的!!

    P.S.为此我交了三遍才过……

信息

ID
1105
难度
6
分类
搜索 | 搜索与剪枝 点击显示
标签
递交数
4342
已通过
1260
通过率
29%
被复制
16
上传者