QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#764692 | #7964. 转化 | yzy_21# | WA | 192ms | 32824kb | C++14 | 1.2kb | 2024-11-20 10:13:24 | 2024-11-20 10:13: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;
}
else st.erase(st.begin());
st2.erase(st2.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: 100
Accepted
time: 145ms
memory: 29840kb
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: -100
Wrong Answer
time: 192ms
memory: 32824kb
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:
31141 772936943 31141 31141 31141 960046994 31141 31141 31141 31141 31141 31141 31141 979942653 31141 31141 31141 995481330 890525427 918992519 697230618 651790978 818480404 31141 31141 31141 31141 31141 31141 724550292 31141 31141 799937783 596800230 31141 849567996 31141 610343546 863032805 31141 ...
result:
wrong answer 1st lines differ - expected: '389246793 773056414 285033292 ...47596 273937941 15883376 150613', found: '31141 772936943 31141 31141 31... 31141 31141 31141 31141 31141 '