QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133437#4931. Comic Bingenameless_story#WA 1ms3592kbC++17689b2023-08-02 09:26:532023-08-02 09:26:58

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 09:26:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2023-08-02 09:26:53]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define N 30000

int a[N],b[N],f[N],sa[N];

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n;   
    for (int i=1;i<=n;++i){
        cin>>a[i];
        sa[i]=sa[i-1]+a[i];
    }
    for (int i=1;i<=n;++i){
        cin>>b[i];
    }
    for (int k=b[1]+sa[n];k<=n*20;++k){
        f[0]=n*21; f[1]=b[1];
        f[n]=n*21;
        for (int i=2;i<=n;++i){
            f[i]=min(f[i-1],f[i-2])+b[i];
            if (f[i]+sa[n]-sa[i-1]>k) f[i]=n*21;
            if (f[i]==n*21&&f[i-1]==n*21) break;
        }
        if (f[n]<n*21){
            cout<<k<<'\n';
            break;
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3492kb

input:

6
3 1 1 1 1 2
1 5 3 3 7 4

output:

13

result:

ok single line: '13'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3428kb

input:

2
2 1
1 1

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3592kb

input:

1
1
1

output:


result:

wrong answer 1st lines differ - expected: '2', found: ''