/ Randle /

记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:56:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(load)modify(t[i].start,load);modify(t[i].end,-load);
   ^~
/in/foo.cc:56:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if(load)modify(t[i].start,load);modify(t[i].end,-load);
                                   ^~~~~~
# 状态 耗时 内存占用
#1 Accepted 3ms 2.426 MiB
#2 Wrong Answer 2ms 1.059 MiB
#3 Wrong Answer 2ms 2.559 MiB
#4 Wrong Answer 2ms 1.18 MiB
#5 Wrong Answer 2ms 1.18 MiB
#6 Wrong Answer 1ms 1.176 MiB
#7 Wrong Answer 17ms 3.176 MiB
#8 Wrong Answer 16ms 1.684 MiB
#9 Wrong Answer 16ms 1.684 MiB
#10 Wrong Answer 16ms 3.176 MiB

代码

#include<bits/stdc++.h>
const int maxn=2e5;
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 int lowbit(int a)
{
	return a&(-a);
}
int k,n,m,more[maxn],ans=0;
struct team
{
	int start,end,num;
}t[maxn];
inline const bool comp(const team&a,const team&b)
{
	if(a.end<b.end)return true;
	else return false;
}
inline const void modify(int a,int b)
{
	while(a<=n)
	{
		more[a]+=b;
		a+=lowbit(a);
	}
}
inline const int query(int a)
{
	int ans=0;
	while(a)
	{
		ans+=more[a];
		a-=lowbit(a);
	}
	return ans;
}
int main()
{
	memset(more,0,sizeof(more));
	read(k);read(n);read(m);
	for(int i=1;i<=k;i++){read(t[i].start);read(t[i].end);read(t[i].num);}
	std::sort(t+1,t+1+k,comp);
	for(int i=1;i<=k;i++)
	{
		int load=std::min(m-query(t[i].start),t[i].num);
		ans+=load;
		if(load)modify(t[i].start,load);modify(t[i].end,-load);
	}
	std::cout<<ans;
	return 0;
}

信息

递交者
类型
递交
题目
公交与怪兽 T2
题目数据
下载
语言
C++
递交时间
2017-10-03 19:04:05
评测时间
2017-10-03 19:04:05
评测机
分数
10
总耗时
82ms
峰值内存
3.176 MiB