QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133433#4931. Comic Bingenameless_story#Compile Error//C++14717b2023-08-02 09:26:082023-08-02 09:26:08

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:08]
  • 评测
  • [2023-08-02 09:26:08]
  • 提交

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;
    vector a(n+1,0),b(n+1,0);
    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

answer.code: In function ‘int main()’:
answer.code:12:12: error: missing template arguments before ‘a’
   12 |     vector a(n+1,0),b(n+1,0);
      |            ^