Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
67044 | 胡海峰老师 | 部分排序 | Python3 | Accepted | 37 MS | 3800 KB | 489 | 2024-03-13 14:00:11 |
n,m = list(map(int,input().split())) a = list(map(int,input().split())) def selection_sort(tmp): a = tmp.copy() n = len(a) for i in range(n-1,0,-1): maxIdx = i for j in range(0,i): if a[j]>a[maxIdx]: maxIdx = j a[maxIdx],a[i] = a[i],a[maxIdx] return a tot = set() for i in range(n-m+1): b = a[i:i+m] res =a[:i] + selection_sort(b) + a[i+m:] tot.add(tuple(res)) print(len(tot))