Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <stdio.h>int a[1000001];inline void swap(int& lhs, int& rhs){static int temp;temp = lhs;lhs = rhs;rhs = temp;}int main(){int n, k;scanf("%d%d", &n, &k);for (int i = 1; i <= n; ++i)scanf("%d", a + i);int begin = 1, end = n, l, r, pos;a[0] = -1;if (k <= n)while (begin <= end){l = begin;pos = begin + 1;r = end;a[0] = a[begin];while (pos <= r){if (a[pos] < a[0])a[l++] = a[pos++];else