QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#307645#7964. 转化ATM12345#WA 81ms20880kbC++141.3kb2024-01-18 23:13:162024-01-18 23:13:16

Judging History

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

  • [2024-01-18 23:13:16]
  • 评测
  • 测评结果:WA
  • 用时:81ms
  • 内存:20880kb
  • [2024-01-18 23:13:16]
  • 提交

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;

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++)
		all+=min(a[i]+c[i],b[i]);
	for (ll i=1;i<=n;i++)
	{
		ll ans=all+a[i]-min(a[i]+c[i],b[i]);
		if (ans)
			ans+=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(c[i],a[i]+b[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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 81ms
memory: 20880kb

input:

351493
0 37836791 46095966 46912389 21595941 0 3 86568894 3 0 0 0 0 39910208 0 2 4 86885825 1 67660833 0 24488082 52447896 0 67190942 70457491 11166998 90470470 11095822 0 0 5 47222930 2 49736354 0 0 0 77339472 0 5 3 0 25347727 0 3 2 0 48844622 0 65142757 1 73733079 80634668 46683173 0 31644647 9760...

output:

60073965108098 60073472434579 60073472434579 60073481786076 60073472434579 60073788795704 60073528186939 60073472434579 60073844417038 60073784237527 60073472434579 60073472434579 60073948724359 60073472434579 60073472434579 60073667243820 60073550392304 60073472434579 60073631606704 60073472434579 ...

result:

wrong answer 1st lines differ - expected: '60073965049724 60073472376204 ...4 60073701685447 60073472376204', found: '60073965108098 60073472434579 ... 60073701743821 60073472434579 '