Memory Exceeded
代码
#include<bits/stdc++.h>
using namespace std;
string sss,s[100000];
int main()
{
int n,m;
cin>>n>>m;
cin>>sss;
int k=0;
for (int i=0;i<=n-1;i++)
{
k++;
for (int j=i;j<=i+m-1;j++)
{
s[k]+=sss[j];
}
}
for (int i=1;i<=k;i++)
cout<<s[i]<<endl;
int ans=0;
for (int i=1;i<=k-1;i++)
for (int j=i+1;j<=k;j++)
if (s[i]>s[j]) swap(s[i],s[j]),ans++;
cout<<ans;
}