diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
commit | 2f674dc80f0382f1c3178f435714960734dc9d3c (patch) | |
tree | 2abba7e4ec72bd16f58f7375126144d3fd9f4bca /12/TP-HN-2008/R1/BL4.pas | |
parent | b2d80610db6beda38573890ed169815e495bc663 (diff) | |
download | cp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz |
Reorganize stuff from secondary school
Diffstat (limited to '12/TP-HN-2008/R1/BL4.pas')
-rw-r--r-- | 12/TP-HN-2008/R1/BL4.pas | 62 |
1 files changed, 0 insertions, 62 deletions
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. |