/ Randle /

记录详情

Memory Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 18ms 30.816 MiB
#2 Wrong Answer 17ms 30.812 MiB
#3 Wrong Answer 18ms 30.812 MiB
#4 Wrong Answer 17ms 30.816 MiB
#5 Time Exceeded ≥1001ms ≥41.461 MiB
#6 Time Exceeded ≥1001ms ≥41.762 MiB
#7 Time Exceeded ≥1002ms ≥30.914 MiB
#8 Memory Exceeded ≥612ms ≥256.0 MiB
#9 Memory Exceeded ≥498ms ≥256.0 MiB
#10 Memory Exceeded ≥533ms ≥256.0 MiB

代码

//#pragma G++ optimize ("O2")
//#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
string s,a[500005],b[500005];
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];
	int ans=0;
    for(int i=1;i<=n;i++)
      for(int j=1;j<=n;j++)
        if(a[i]<a[j])
          ans++,swap(a[j],a[i]);
//    for(int i=1;i<=n;i++)
//      cout<<a[i]<<endl;
    
//    for(int i=1;i<=n;i++)
//      if(a[i]!=b[i])
//        ans++;
    printf("%d",ans);
	return 0;
}

信息

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