QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764638#7964. 转化EZGG#WA 78ms11600kbC++231.4kb2024-11-20 10:03:402024-11-20 10:03:48

Judging History

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

  • [2024-11-20 10:03:48]
  • 评测
  • 测评结果:WA
  • 用时:78ms
  • 内存:11600kb
  • [2024-11-20 10:03:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    ll sum = 0, ans = 0;
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    for (ll i = 0; i < n; i++)
        cin >> b[i];
    vector<ll> lst;
    for (ll i = 0; i < n; i++)
    {
        cin >> c[i];
        if (a[i] != 0)
        {
            a[i] += c[i];
            c[i] = 0;
            ll tmp = min(a[i], b[i]);
            ans += a[i];
            a[i] -= tmp;
            sum += tmp;
        }
        else if (b[i] != 0)
        {
            ll tmp = min(b[i], c[i] + 1) - 1;
            ans+=c[i];
            c[i] -= tmp;
            sum += tmp;
        }
        else
        {
            lst.push_back(c[i]);
        }
    }
    for (int i = 0; i < n; i++)
    {
        cout << a[i] + sum << " ";
    }
    cout << "\n";
    if (sum == 0)
    {
        cout << accumulate(a.begin(), a.end(), 0ll);
    }
    else
    {
        sort(lst.begin(), lst.end(), greater<ll>());
        for (ll i = 0; i < min<ll>(lst.size(),sum); i++)
        {
            ans+=lst[i];
        }
        cout<<ans;
    }
}
int main()
{
#if !LOCAL
    ios::sync_with_stdio(0);
    cin.tie(0);
#endif
    int tt = 1;
    // cin >> tt;
    while (tt--)
        solve();
#if LOCAL
    system("pause");
#endif
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 78ms
memory: 11600kb

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:

60073472376204 60073472376204 60073472376204 60073481727701 60073472376204 60073472376204 60073528128564 60073472376204 60073844358663 60073472376204 60073472376204 60073472376204 60073472376204 60073472376204 60073472376204 60073667185445 60073550333929 60073472376204 60073631548329 60073472376204 ...

result:

wrong answer 1st lines differ - expected: '60073965049724 60073472376204 ...4 60073701685447 60073472376204', found: '60073472376204 60073472376204 ... 60073472376204 60073472376204 '