QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764704#7964. 转化yzy_21#WA 222ms29640kbC++141.3kb2024-11-20 10:17:252024-11-20 10:17:26

Judging History

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

  • [2024-11-20 10:17:26]
  • 评测
  • 测评结果:WA
  • 用时:222ms
  • 内存:29640kb
  • [2024-11-20 10:17:25]
  • 提交

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;
}

详细

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 '