#include #include int FindMaxi(int record[],int a[],int begin,int end){ int max=record[a[begin]],i=a[begin]; while(begin max) { max=record[a[begin]]; i=a[begin]; } ++begin; } return i;}int main(){ int n,m,i,record[1001],rank[1001]; scanf("%d %d",&n,&m); int *a=(int*)malloc(n*sizeof(int)); for(i=0;i 1) { if(curscale%m) nextscale=curscale/m+1; else nextscale=curscale/m; int begin=0,end,j=0,*ta=(int*)malloc(nextscale*sizeof(int)); while(begin =m) end=begin+m; else end=curscale; i=FindMaxi(record,a,begin,end); ta[j++]=i; int k; for(k=begin;k