QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#769931#7964. 转化yasdf123WA 241ms15940kbC++201.0kb2024-11-21 19:58:012024-11-21 19:58:02

Judging History

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

  • [2024-11-21 19:58:02]
  • 评测
  • 测评结果:WA
  • 用时:241ms
  • 内存:15940kb
  • [2024-11-21 19:58:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

int a[4000006], b[4000006], c[4000006];

signed main(){
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (a[i] == 0){
			cnt++;
		}
	}
	for (int i = 0; i < n; i++){
		cin >> b[i];
	}
	for (int i = 0; i < n; i++){
		cin >> c[i];
		if (a[i] != 0){
			a[i] += c[i];
			c[i] = 0;
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++){
		if (a[i] != 0){
			sum += min(a[i], b[i]);
		}
	}
	for (int i = 0; i < n; i++){
		if (a[i] == 0 && b[i]>0 && c[i]>0&&sum>0){
			a[i]=c[i]-1;
			c[i]=0;
			b[i]--;
			sum += min(b[i], a[i]);
		}
	}
	for (int i = 0; i < n; i++){
		cout << a[i] + c[i] + sum - min(a[i],b[i]) << " ";
	}
	cout << "\n";
	vector<int> lst;
	int ans=0;
	for (int i = 0; i < n; i++){
		if (a[i] == 0){
			lst.push_back(c[i]);
		}
		ans+=a[i];
	}
	sort(lst.begin(),lst.end(),greater<int>());
	for(int i=0;i<min(sum,(int)lst.size());i++){
		ans+=lst[i];
//		cout<<lst[i];
	}
	
	cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 241ms
memory: 15940kb

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 '