QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#769931 | #7964. 转化 | yasdf123 | WA | 241ms | 15940kb | C++20 | 1.0kb | 2024-11-21 19:58:01 | 2024-11-21 19:58:02 |
Judging History
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;
}
详细
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 '