QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#764541#7964. 转化EZGG#WA 82ms11456kbC++231.4kb2024-11-20 09:38:562024-11-20 09:39:06

Judging History

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

  • [2024-11-20 09:39:06]
  • 评测
  • 测评结果:WA
  • 用时:82ms
  • 内存:11456kb
  • [2024-11-20 09:38:56]
  • 提交

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, exc = 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;
            int tmp = min(a[i], b[i]);
            ans += a[i];
            a[i] -= tmp;
            sum += tmp;
        }
        else if (b[i] != 0)
        {
            int tmp = min(b[i], c[i] + 1) - 1;
            c[i] -= tmp;
            sum += tmp;
        }
        else
        {
            lst.push_back(c[i]);
        }
    }
    for (int i = 0; i < n; i++)
    {
        cout << a[i] + c[i] + sum << " ";
    }
    cout << "\n";
    if (sum == 0)
    {
        cout << accumulate(a.begin(), a.end(), 0);
    }
    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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 82ms
memory: 11456kb

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:

wrong answer 2nd lines differ - expected: '90874342016986', found: '58719089343190'