/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 1ms 256.0 KiB
#2 Accepted 18ms 256.0 KiB
#3 Accepted 0ms 256.0 KiB
#4 Accepted 16ms 256.0 KiB
#5 Accepted 1ms 172.0 KiB
#6 Accepted 12ms 256.0 KiB
#7 Accepted 4ms 256.0 KiB
#8 Accepted 7ms 256.0 KiB
#9 Accepted 5ms 256.0 KiB
#10 Accepted 15ms 256.0 KiB

代码

var n,m,i,j,k,s1,s2,ans,x,y:longint;
    a,u:array[1..100,1..100]of boolean;
begin
 readln(n,m);
 fillchar(a,sizeof(a),false);
 fillchar(u,sizeof(u),false);
 for i:=1 to m do begin
  readln(x,y);
  a[x,y]:=true;
  u[y,x]:=true;
 end;
 for k:=1 to n do
  for i:=1 to n do
   for j:=1 to n do
    if (i<>j)and(j<>k)and(i<>k) then begin
     a[i,j]:=a[i,j]or((a[i,k])and(a[k,j]));
     u[i,j]:=u[i,j]or((u[i,k])and(u[k,j]));
     end;
  for i:=1 to n do begin
   s1:=0; s2:=0;
   for j:=1 to n do begin
    if (i<>j)and(a[i,j]) then inc(s1);
    if (i<>j)and(u[i,j]) then inc(s2);
   end;
   if (s1>(n-1)div 2)or(s2>(n-1)div 2)then inc(ans);
  end;
 writeln(ans);
end.

信息

递交者
类型
递交
题目
珍珠
题目数据
下载
语言
Pascal
递交时间
2017-08-22 13:44:32
评测时间
2017-08-22 13:44:32
评测机
分数
100
总耗时
84ms
峰值内存
256.0 KiB