/ Randle /

记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:31:10: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
    if(!(j-i&1))ans[++d]=p[l/2+1];
         ~^~
# 状态 耗时 内存占用
#1 Wrong Answer 3ms 324.0 KiB
#2 Wrong Answer 3ms 2.32 MiB
#3 Wrong Answer 2ms 324.0 KiB
#4 Wrong Answer 5ms 2.441 MiB
#5 Wrong Answer 4ms 456.0 KiB
#6 Wrong Answer 4ms 448.0 KiB
#7 Wrong Answer 92ms 4.691 MiB
#8 Wrong Answer 117ms 1.258 MiB
#9 Time Exceeded ≥1006ms ≥2.887 MiB
#10 Time Exceeded ≥1006ms ≥1.066 MiB

代码

#include<bits/stdc++.h>
const int maxn=100000|1;
inline const void read(int &a)
{
	a=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
}
inline const void write(int a)
{
	if(a>9)write(a/10);
	putchar(a%10+'0');
}
int n,k,a[maxn],ans[maxn<<4],d=0;
int main()
{
	read(n);read(k);
	for(int i=1;i<=n;i++)read(a[i]);
	for(int i=1;i<=n;i++)
	{
		int p[maxn],l=0,r;
		for(int j=i;j<=n;j++)
		{
			p[++l]=a[j];r=l;
			while(r>1&&p[r]<p[r-1]){std::swap(p[r],p[r-1]);--r;}
			if(!(j-i&1))ans[++d]=p[l/2+1];
		}
	}
	std::sort(ans+1,ans+1+d);
	write(ans[k]);
	return 0;
}

信息

递交者
类型
递交
题目
第k大区间 T2
题目数据
下载
语言
C++
递交时间
2017-10-07 14:40:58
评测时间
2017-10-07 14:40:58
评测机
分数
0
总耗时
≥2246ms
峰值内存
≥4.691 MiB