/ Randle /

记录详情

Memory Exceeded


  
# 状态 耗时 内存占用
#1 Wrong Answer 3ms 3.324 MiB
#2 Wrong Answer 2ms 3.316 MiB
#3 Wrong Answer 2ms 3.32 MiB
#4 Wrong Answer 3ms 3.348 MiB
#5 Wrong Answer 30ms 19.652 MiB
#6 Wrong Answer 34ms 20.172 MiB
#7 Wrong Answer 13ms 3.402 MiB
#8 Memory Exceeded ≥654ms ≥256.0 MiB
#9 Memory Exceeded ≥538ms ≥256.0 MiB
#10 Memory Exceeded ≥581ms ≥256.0 MiB

代码

//#pragma G++ optimize ("O2")
//#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
string s,a[50005],b[50005];
int m,n;
int main()
{
//    freopen("sort.in","r",stdin);
//    freopen("sort.out","w",stdout);
	scanf("%d %d",&n,&m);
	cin>>s;
	for(int i=0;i<=n-m+1;i++)
	  for(int j=1;j<=m;j++)
	    if((i+j-1)<=n-1)
	    {
	      a[i+1]+=s[i+j-1];
		}
	for(int i=1;i<=n;i++)
	  b[i]=a[i];
    sort(a+1,a+n+1);
//    for(int i=1;i<=n;i++)
//      cout<<a[i]<<endl;
    int ans=0;
    for(int i=1;i<=n;i++)
      if(a[i]!=b[i])
        ans++;
    printf("%d",ans);
	return 0;
}

信息

递交者
类型
递交
题目
后缀数组
题目数据
下载
语言
C++
递交时间
2019-12-13 15:35:14
评测时间
2019-12-13 15:35:14
评测机
分数
0
总耗时
≥1864ms
峰值内存
≥256.0 MiB