QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#290102#7964. 转化daydream#WA 87ms12380kbC++201.5kb2023-12-24 13:26:392023-12-24 13:26:40

Judging History

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

  • [2023-12-24 13:26:40]
  • 评测
  • 测评结果:WA
  • 用时:87ms
  • 内存:12380kb
  • [2023-12-24 13:26:39]
  • 提交

answer

#include<bits/stdc++.h>
#define db double
#define LL long long
#define pb push_back
#define eb emplace_back
#define pli pair<LL,int>
#define pii pair<int,int>
#define fr first
#define sc second
#define mp make_pair
using namespace std;
const int dx[]={0,1,0,-1,1,1,-1,-1},
		  dy[]={1,0,-1,0,1,-1,1,-1};

int n;
void solve()
{
	cin>>n;vector<int> a(n+1),b(n+1),c(n+1),ex(n+1);
	for(int i=1;i<=n;++i) cin>>a[i];
	for(int i=1;i<=n;++i) cin>>b[i];
	for(int i=1;i<=n;++i) cin>>c[i];
	int cnt=0;LL sum=0;vector<pli> vt;
	for(int i=1;i<=n;++i)
	{
		if(a[i]) a[i]+=c[i],c[i]=0,sum+=min(a[i],b[i]);
		else if(b[i]&&c[i]) ++cnt,vt.eb(min(b[i],c[i]),i);
	}
	sort(vt.begin(),vt.end(),greater<pli>());
	for(int i=1;i<cnt;++i) vt[i].fr+=vt[i-1].fr;
	for(int i=0;i<cnt;++i) ex[vt[i].sc]=i+1;
//	cout<<cnt<<' '<<sum<<'\n';
	int K=min(cnt+0ll,sum);
	if(!vt.empty()) vt.eb(vt.back());
	for(int i=1;i<=n;++i)
	{
		LL ans=sum+a[i]-min(a[i],b[i]);
		if(K)
		{
			if(!ex[i]) ans+=vt[K-1].fr-K;
			else if(ex[i]<=K) ans+=vt[K].fr-K+c[i]-min(b[i],c[i]);
			else ans+=vt[K-1].fr-K+c[i];
		}
		cout<<ans<<' ';
	}
	cout<<'\n';
	sum=cnt=0;vector<LL> Vt;
	for(int i=1;i<=n;++i)
		if(a[i]) sum+=a[i];
		else cnt++,Vt.pb(c[i]);
	sort(Vt.begin(),Vt.end(),greater<LL>());
	for(int i=1;i<cnt;++i) Vt[i]+=Vt[i-1];
	if(cnt) sum+=Vt[min(cnt+0ll,sum)-1];
	cout<<sum<<'\n';
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int TT=1;
//	cin>>TT;
	for(;TT;--TT) solve();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 87ms
memory: 12380kb

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:

60073964990999 60073472317480 60073472317480 60073481668977 60073472317480 60073788678605 60073528069840 60073472317480 60073844299939 60073784120428 60073472317480 60073472317480 60073948607260 60073472317480 60073472317480 60073667126721 60073550275205 60073472317480 60073631489605 60073472317480 ...

result:

wrong answer 1st lines differ - expected: '60073965049724 60073472376204 ...4 60073701685447 60073472376204', found: '60073964990999 60073472317480 ... 60073701626722 60073472317480 '