QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#764704 | #7964. 转化 | yzy_21# | WA | 222ms | 29640kb | C++14 | 1.3kb | 2024-11-20 10:17:25 | 2024-11-20 10:17:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
using pii = pair<int, int>;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;cin >> n;
vector<int> a(n + 1), b(n + 1), c(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];
set<int> st;
set<pii, greater<pii>> st2;
for(int i = 1; i <= n; ++i) {
if(a[i] != 0) {
a[i] += c[i];
c[i] = 0;
st.insert(i);
}
else st2.insert({c[i], i});
}
while(st.size() and st2.size()) {
int i = *st.begin();
int j = st2.begin()->second;
if(a[i] > 1) {
a[i]--;
a[j] = c[j] + 1;
c[j] = 0;
st2.erase(st2.begin());
if(a[j] > 1) st.insert(j);
}
else st.erase(st.begin());
}
int ans = 0, sum = 0;
for(int i = 1; i <= n; ++i) {
int x = min(a[i], b[i]);
sum += min(a[i], b[i]);
ans += a[i];
a[i] -= x;
}
for(int i = 1; i <= n; ++i) {
cout << sum + a[i] << " ";
}
cout << "\n";
cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 222ms
memory: 29640kb
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 60073472492797 60073472492797 60073481844294 60073472492797 60073788853923 60073528245157 60073472492797 60073844475256 60073784295746 60073472492797 60073472492797 60073948782578 60073472492797 60073472492797 60073667302038 60073550450522 60073472492797 60073631664922 60073472492797 ...
result:
wrong answer 1st lines differ - expected: '60073965049724 60073472376204 ...4 60073701685447 60073472376204', found: '60073965049724 60073472492797 ... 60073701802040 60073472492797 '