QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546897#7964. 转化wangjingheng#WA 82ms25956kbC++201.2kb2024-09-04 15:36:072024-09-04 15:36:07

Judging History

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

  • [2024-09-04 15:36:07]
  • 评测
  • 测评结果:WA
  • 用时:82ms
  • 内存:25956kb
  • [2024-09-04 15:36:07]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define db long double
using namespace std;
const int N=5e5+10;
int a[N],b[N],c[N],f[N],s[N],ss[N];
void solve(){
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>c[i];
    for(int i=1;i<=n;i++) cin>>b[i];
    for(int i=1;i<=n;i++){
        //转移
        if(a[i]==0){
        f[i]=min(b[i]+1,c[i])-1;
        ss[i]=ss[i-1]+f[i];
        s[i]=s[i-1];
        }
        else{
        int mid=c[i]-a[i];
        mid=max(0ll,mid);
        mid=min(mid,b[i]);
        f[i]=a[i]+mid;
        ss[i]=ss[i-1];
        s[i]=f[i]+s[i-1];
        }
        
    }
    for(int i=1;i<=n;i++){
        if(a[i]){
        int res=a[i]+b[i]+s[n]-f[i];
        if(ss[n]&&s[n]){
            res+=ss[n];
        }
        cout<<res<<" ";
        }
        else{
            int res=b[i]+s[n];
            if(s[n]&&ss[n]) res+=ss[n]-f[i];
            if(!s[n]) res=0;
            cout<<res<<" ";
        }
        
    }
    int ans=0;
    cout<<"\n";
    for(int i=1;i<=n;i++){
        ans+=a[i]+b[i];
    }
    cout<<ans;
}

signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
//    int T;cin>>T;
//    while(T--)
    solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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:

60181916377351 60181423703831 60181423703831 60181433055328 60181423703831 60181740064957 60181479456191 60181423703831 60181795686290 60181735506780 60181423703831 60181423703831 60181899993612 60181423703831 60181423703831 60181618513072 60181501661556 60181423703831 60181582875956 60181423703831 ...

result:

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