/ 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 1ms 320.0 KiB
#2 Wrong Answer 1ms 320.0 KiB
#3 Wrong Answer 2ms 2.32 MiB
#4 Wrong Answer 5ms 2.438 MiB
#5 Wrong Answer 4ms 2.441 MiB
#6 Wrong Answer 3ms 452.0 KiB
#7 Wrong Answer 80ms 4.816 MiB
#8 Wrong Answer 90ms 1.309 MiB
#9 Time Exceeded ≥1006ms ≥1.07 MiB
#10 Time Exceeded ≥1007ms ≥1.062 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:19:07
评测时间
2017-10-07 14:22:03
评测机
分数
0
总耗时
≥2203ms
峰值内存
≥4.816 MiB