QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#715725#7964. 转化szy10010#WA 81ms21924kbC++201.7kb2024-11-06 13:11:352024-11-06 13:11:36

Judging History

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

  • [2024-11-06 13:11:36]
  • 评测
  • 测评结果:WA
  • 用时:81ms
  • 内存:21924kb
  • [2024-11-06 13:11:35]
  • 提交

answer

#include<iostream>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<cstring>
#include<algorithm>
#include<unordered_map>

#define pb push_back
#define fi first
#define se second
#define int long long
#define all(x) (x).begin(),(x).end()
#define _for(i, a) for(int i = 0; i < (a); ++i) 
#define _rep(i, a, b) for(int i = (a);i <= (b); ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define u1 (u<<1)
#define u2 (u<<1|1)
//#define endl '\n'
using namespace std;
typedef pair<int,int> PII;

const int INF=0x3f3f3f3f;
const int P=1e9+7;
const int N=1e6+20,M=2*N;
int n,m,k,q[N];
int a[N],b[N],c[N];
void solve(){
	cin>>n;
	_rep(i,1,n)cin>>a[i];
	_rep(i,1,n)cin>>b[i];
	_rep(i,1,n)cin>>c[i];
	int cnt=0,sum=0,ans=0;
	int t=0;
	bool bl=false;
	vector<int> v;
	_rep(i,1,n)
	{
		if(!a[i])
		{
			if(min(c[i]+1,b[i])>=1)
			{
				cnt++;
				sum+=min(c[i]+1,b[i]); 
			}
			v.pb(c[i]);
		}
		else 
		{
			a[i]+=c[i];
			ans+=a[i];
			sum+=min(a[i],b[i]); 
			if(b[i])bl=true;
		}
	}
	sort(all(v),greater<int>());
//	cout<<sum<<endl;
//	cout<<cnt<<endl;
	_rep(i,1,n)
	{
		if(!bl)cout<<a[i]<<" ";
		else 
		{
			if(!a[i])
			{
				if(min(c[i]+1,b[i])>=1)
				{
					cout<<a[i]+sum-cnt-(min(c[i]+1,b[i])-1)+c[i]<<' ';
				}
				else cout<<a[i]+sum-cnt+c[i]<<" ";
			}
			else cout<<a[i]+sum-cnt-min(a[i],b[i])<<" ";
		}
	}
	cout<<'\n';
	if(!bl)cout<<ans;
	else{
//		cout<<ans+t;
		_for(i,min(sum-cnt,(int)v.size())){
			ans+=v[i];
//			cout<<v[i]<<" ";
		}
		cout<<ans;
	}
}
signed main(){
	IOS;
	int T=1;
//	cin>>T;
	_rep(i,1,T){
		solve();
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 80ms
memory: 20384kb

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:

60073965049724 60073472376204 60073472376204 60073481727701 60073472376204 60073788737330 60073528128564 60073472376204 60073844358663 60073784179153 60073472376204 60073472376204 60073948665985 60073472376204 60073472376204 60073667185445 60073550333929 60073472376204 60073631548329 60073472376204 ...

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 59ms
memory: 21684kb

input:

351493
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 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 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

389246793 773056414 285033292 35143062 150613 960166465 230310734 742299190 422307527 716629610 559282116 167517603 440667606 980062124 288964464 150613 37777273 995600801 890644898 919111990 697350089 651910449 818599875 248723392 345836780 145972754 169220149 798545767 375398590 724669763 34806631...

result:

ok 2 lines

Test #3:

score: -100
Wrong Answer
time: 81ms
memory: 21924kb

input:

351493
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 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 1 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 1 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

599928111 417141936 854896025 376367102 774244714 431347641 604428665 574576714 470717519 508427611 661004235 780213577 84639091 782348432 977630323 52634924 626665121 482558683 636948807 603433753 409075001 417850332 684775391 679542511 719331660 492363039 456376909 467979366 476324957 877501995 64...

result:

wrong answer 2nd lines differ - expected: '131418054091667', found: '119781886715010'