Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
168191 | 袁梓皓_B班 | 常用排序法 | C++ | 通过 | 100 | 37 MS | 636 KB | 576 | 2024-08-19 23:49:57 |
using namespace std; void Qsort(int arr[], int start, int end) { int lt = start, rt = end; if(start >= end) return ; int q = arr[start]; while(lt < rt) { while(rt > lt && arr[rt] >= q) rt--; while(lt < rt && arr[lt] <= q) lt++; swap(arr[lt], arr[rt]); } arr[start] = arr[lt]; arr[lt] = q; Qsort(arr, start, lt - 1); Qsort(arr, lt + 1, end); } int main() { int a[114514], n; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; Qsort(a, 1, n); for(int i = 1; i <= n; i++) cout << a[i] << ' '; return 0; }
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0
exit code: 0, checker exit code: 0