QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133437 | #4931. Comic Binge | nameless_story# | WA | 1ms | 3592kb | C++17 | 689b | 2023-08-02 09:26:53 | 2023-08-02 09:26:58 |
Judging History
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: ''