记录编号 |
121184 |
评测结果 |
AAAAAAA |
题目名称 |
[NOIP 2003]神经网络 |
最终得分 |
100 |
用户昵称 |
筽邝 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2014-09-18 18:05:38 |
内存使用 |
0.32 MiB |
显示代码纯文本
program cojs104;
const
mm=-maxlongint;
var
x,y,n,m,i,j:longint;
d,c,u:array[1..200]of longint;
g:array[1..200,1..200]of longint;
flag:boolean;
procedure sum(k:longint);
var
i:longint;
begin
c[k]:=-u[k];
for i:=1 to n do
if g[i,k]<>mm then
begin
if c[i]=mm then sum(i);
if c[i]>0 then inc(c[k],c[i]*g[i,k]);
end;
end;
begin
assign(input,'sjwl.in');reset(input);
assign(output,'sjwl.out');rewrite(output);
readln(n,m);
for i:=1 to n do
for j:=1 to n do
g[i,j]:=mm;
for i:=1 to n do
begin
readln(c[i],u[i]);
if c[i]=0 then c[i]:=mm;
end;
for i:=1 to m do
begin
read(x,y);
readln(g[x,y]);
inc(d[x]);
end;
for i:=1 to n do
if c[i]=mm then sum(i);
flag:=false;
for i:=1 to n do
if (d[i]=0)and(c[i]>0) then
begin
writeln(i,' ',c[i]);
flag:=true;
end;
if not flag then writeln('NULL');
close(input);close(output);
end.