From 2f674dc80f0382f1c3178f435714960734dc9d3c Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sat, 6 Jun 2020 21:33:13 +0700 Subject: Reorganize stuff from secondary school --- 12/TP-HN-2008/R1/BL4.pas | 62 ------------------------------------------------ 1 file changed, 62 deletions(-) delete mode 100644 12/TP-HN-2008/R1/BL4.pas (limited to '12/TP-HN-2008/R1/BL4.pas') diff --git a/12/TP-HN-2008/R1/BL4.pas b/12/TP-HN-2008/R1/BL4.pas deleted file mode 100644 index c552b0d..0000000 --- a/12/TP-HN-2008/R1/BL4.pas +++ /dev/null @@ -1,62 +0,0 @@ -var - f: text; - n, i: int16; - a, b: array of int32; - - -procedure swp(var x, y: int32); - var - tmp: int32; - - begin - tmp := x; - x := y; - y := tmp - end; - - -procedure qsort(l, h: int16); - var - i, j: int16; - tmp: int32; - - begin - i := l; - j := h; - tmp := a[(l + h) div 2]; - - repeat - while a[i] < tmp do - inc(i); - while a[j] > tmp do - dec(j); - - if i <= j then - begin - swp(a[i], a[j]); - swp(b[i], b[j]); - inc(i); - dec(j) - end; - until i > j; - - if l < j then - qsort(l, j); - if i < h then - qsort(i, h) - end; - - -begin - assign(f, 'CLB.IN'); - reset(f); - readln(f, n); - setlength(a, n); - setlength(b, n); - for i := 0 to n - 1 do - readln(f, a[i], b[i]); - close(f); - qsort(0, n - 1); - for i := 0 to n - 1 do - writeln(a[i], ' ', b[i]) -end. -- cgit 1.4.1