program Time;
uses BaseUnix, Unix;
var
start, finish, res: int64;
n, i, j: Integer;
g: Array of Array of Integer;
t: Cardinal;
function GetTickCount: Cardinal; stdcall;
var
t: timeval;
begin
fpgettimeofday(@t, nil);
GetTickCount := t.tv_sec * 1000 + t.tv_usec div 1000;
end;
begin
n := 8000;
SetLength(g, n, n);
t := GetTickCount;
for i:=1 to n-1 do
for j:=1 to n-1 do
g[i,j] := 1;
writeln('Time by rows:', GetTickCount - t, ' tics' );
t := GetTickCount;
for i:=1 to n-1 do
for j:=1 to n - 1 do
g[j,i] := 1;
writeln('Time by cols:', GetTickCount - t, ' tics' );
end.
cHJvZ3JhbSBUaW1lOwp1c2VzIEJhc2VVbml4LCBVbml4OwogICB2YXIKICAgICAgc3RhcnQsIGZpbmlzaCwgcmVzOiBpbnQ2NDsKICAgICAgbiwgaSwgajogSW50ZWdlcjsKICAgICAgZzogQXJyYXkgb2YgQXJyYXkgb2YgSW50ZWdlcjsKICAgICAgdDogQ2FyZGluYWw7CmZ1bmN0aW9uIEdldFRpY2tDb3VudDogQ2FyZGluYWw7IHN0ZGNhbGw7CnZhcgogIHQ6IHRpbWV2YWw7CmJlZ2luCiAgZnBnZXR0aW1lb2ZkYXkoQHQsIG5pbCk7CiAgR2V0VGlja0NvdW50IDo9IHQudHZfc2VjICogMTAwMCArIHQudHZfdXNlYyBkaXYgMTAwMDsKZW5kOwpiZWdpbgogICBuIDo9IDgwMDA7CiAgIFNldExlbmd0aChnLCBuLCBuKTsKICAgdCA6PSBHZXRUaWNrQ291bnQ7CiAgIGZvciBpOj0xIHRvIG4tMSBkbwogICAgICBmb3Igajo9MSB0byBuLTEgZG8KICAgICAgICAgZ1tpLGpdIDo9IDE7CiAgIHdyaXRlbG4oJ1RpbWUgYnkgcm93czonLCBHZXRUaWNrQ291bnQgLSB0LCAnIHRpY3MnICk7CiAgIHQgOj0gR2V0VGlja0NvdW50OwogICBmb3IgaTo9MSB0byBuLTEgZG8KICAgICAgZm9yIGo6PTEgdG8gbiAtIDEgZG8KICAgICAgICAgZ1tqLGldIDo9IDE7CiAgIHdyaXRlbG4oJ1RpbWUgYnkgY29sczonLCBHZXRUaWNrQ291bnQgLSB0LCAnIHRpY3MnICk7CmVuZC4=