/ Randle /

记录详情

Memory Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 3ms 3.32 MiB
#2 Accepted 2ms 3.332 MiB
#3 Accepted 2ms 3.32 MiB
#4 Accepted 3ms 3.316 MiB
#5 Time Exceeded ≥1001ms ≥21.371 MiB
#6 Time Exceeded ≥1001ms ≥21.688 MiB
#7 Time Exceeded ≥1002ms ≥3.461 MiB
#8 Memory Exceeded ≥676ms ≥256.0 MiB
#9 Memory Exceeded ≥573ms ≥256.0 MiB
#10 Memory Exceeded ≥603ms ≥256.0 MiB

代码

#include<bits/stdc++.h>
using namespace std;
string sss,s[100000];
int main()
{
//	freopen("sort.in","r",stdin);
//	freopen("sort.out","w",stdout);
	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];
		}
	}
	
	int ans=0;
	for (int i=1;i<=k;i++)
	for (int j=1;j<=k-1;j++)
	{
	if (s[j]>s[j+1]) swap(s[j],s[j+1]),ans++;
	}	
	cout<<ans;
}

信息

递交者
类型
递交
题目
后缀数组
题目数据
下载
语言
C++
递交时间
2019-12-13 16:00:50
评测时间
2019-12-13 16:00:54
评测机
分数
40
总耗时
≥4870ms
峰值内存
≥256.0 MiB