QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#307652#7963. 多折较差验证ATM12345#WA 1ms5972kbC++141.5kb2024-01-18 23:40:072024-01-18 23:40:07

Judging History

你现在查看的是最新测评结果

  • [2024-01-18 23:40:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5972kb
  • [2024-01-18 23:40:07]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define LL long long
#define ls p<<1
#define rs p<<1|1
#define Ma 1000005
#define mod 1000000007
#define PLL pair<ll,ll>
#define PDD pair<double,double>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define N 61
#define pb push_back
#define ld long double
#define all(x) x.begin(),x.end()
#define inf 1e18

using namespace std;
ll n,m,k;
ll a[Ma],b[Ma],c[Ma];
ll all=0,all2=0;

struct node{
	ll a,b,c;
	bool operator <(const node &A)const{
		if (b==A.b)
			return c>A.c;
		return b>A.b;
	}
};

void sol()
{
	cin>>n;
	for (ll i=1;i<=n;i++)
		cin>>a[i];
	for (ll i=1;i<=n;i++)
		cin>>b[i];
	for (ll i=1;i<=n;i++)
		cin>>c[i];
	for (ll i=1;i<=n;i++)
	{
		if (a[i])
			a[i]+=c[i],c[i]=0,all+=min(a[i],b[i]);
		else if (b[i]&&c[i]) all2+=max(0ll,min(b[i]-1,c[i]));
	}
	for (ll i=1;i<=n;i++)
	{
		ll ans=all+a[i]-min(a[i],b[i]);
		if (ans)
			ans+=all2;
		if (!a[i]&&all) ans+=c[i]-max(0ll,min(b[i]-1,c[i]));
		printf("%lld ",ans);
	}
	printf("\n");
	ll ans=0,ok=0;
	vector <node> v;
	for (ll i=1;i<=n;i++)
	{
		ans+=a[i];
		if (a[i])
		{
			ans+=c[i];
			ok+=min(b[i],a[i]+c[i]);
		}
		else
			v.pb({a[i],b[i],c[i]});
	}
	sort(all(v));
	for (auto z:v)
	{
		if (!ok)
			continue;
		ok--;
		ans+=z.c,ok+=min(z.c,z.a+z.b);
	}
	printf("%lld\n",ans);
	return;
}

int main()
{
	IOS
	ll tt=1;
	//cin>>tt;
	while (tt--)
		sol();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5972kb

input:

5000
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

wrong answer 1st lines differ - expected: '5000 12497500', found: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '