QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#764698#7964. 转化yzy_21#WA 228ms29784kbC++141.2kb2024-11-20 10:15:492024-11-20 10:15:49

Judging History

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

  • [2024-11-20 10:15:49]
  • 评测
  • 测评结果:WA
  • 用时:228ms
  • 内存:29784kb
  • [2024-11-20 10:15:49]
  • 提交

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());
        if(a[j] > 1) st.insert(j);
    }
    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: 228ms
memory: 29784kb

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 '