Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

why does my code cause a runtime error?
Author: yuan
ID: 045983
Problem: 520
Contest: 0
Date: 2011-08-05 18:13:06

my code:
var n,m,i,x,y,t,sum,tt:integer;
f,q:array[1..1000] of boolean;
a,b,v,pre,last:array[1..2000] of integer;
procedure add(x,y:integer);
begin inc(sum);
v[sum]:=y;
pre[sum]:=last[x];
last[x]:=sum; end;
begin
readln(n,m);
for i:=1 to m do
begin readln(x,y);
add(x,y);
add(y,x); end;
sum:=1; a[1]:=1; b[1]:=1; q[1]:=true;
repeat
inc(t); tt:=last[a[t]];
while tt<>0 do
begin y:=v[tt];
if not q[y] then
begin q[y]:=true;
inc(sum);
a[sum]:=y;
b[y]:=b[a[t]]+1; end;
tt:=pre[tt]; end;
until t=sum;
repeat
tt:=last[a[t]];
while tt<>0 do
begin y:=v[tt];
if b[y]+1=b[a[t]] then
f[y]:=f[y] or not f[a[t]];
tt:=pre[tt] end;
dec(t);
until t=1;
if f[1] then writeln('Vladimir')
else writeln('Nikolay');
end.

see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-09-21 12:36:36Online Contester Team © 2002 - 2016. All rights reserved.