QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133675#4931. Comic Bingewtn135687#WA 1ms3492kbC++14810b2023-08-02 12:49:042023-08-02 12:49:06

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 12:49:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3492kb
  • [2023-08-02 12:49:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll

const int N = 1e3+10,mo = 1e9+7;

int a[N],b[N];
int pre[N],suf[N];
int dp1[N],dp2[N];
inline void solve(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i) cin>>a[i],pre[i]=pre[i-1]+a[i];
    for(int i=1;i<=n;++i) cin>>b[i];
    for(int i=n;i>=1;--i) suf[i]=suf[i+1]+a[i];
    dp1[n+1]=mo,dp2[0]=mo,dp1[n]=a[n]+b[n];
    for(int i=n-1;i>=1;--i){
        dp1[i]=max(min(dp1[i+1],dp1[i+2]),suf[i])+b[i];
    }
    for(int i=2;i<=n;++i){
        dp2[i]=max(min(dp2[i+1],dp2[i+2]),pre[i])+b[i];
    }
    cout<<min(dp1[1],dp2[n])<<endl;
}



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



详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3480kb

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: 1ms
memory: 3492kb

input:

2
2 1
1 1

output:

4

result:

ok single line: '4'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3428kb

input:

1
1
1

output:

0

result:

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