记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:5:74: error: 'ans' was not declared in this scope
     scanf("%d%d",&n,&t);for(register int i=1;i<=n;i++) scanf("%d",&c[i]),ans+=c[i];
                                                                          ^~~
/in/foo.cc:6:5: error: 'ans' was not declared in this scope
  if(ans<n) return printf("-1\n"),0;for(register int i=1;i<=t;i++) for(register int j=n;j>=a[i];j--) f[j]=max(f[j],f[j-c[i]]+c[i]);
     ^~~
/in/foo.cc:6:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if(ans<n) return printf("-1\n"),0;for(register int i=1;i<=t;i++) for(register int j=n;j>=a[i];j--) f[j]=max(f[j],f[j-c[i]]+c[i]);
  ^~
/in/foo.cc:6:36: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
  if(ans<n) return printf("-1\n"),0;for(register int i=1;i<=t;i++) for(register int j=n;j>=a[i];j--) f[j]=max(f[j],f[j-c[i]]+c[i]);
                                    ^~~
/in/foo.cc:6:91: error: 'a' was not declared in this scope
  if(ans<n) return printf("-1\n"),0;for(register int i=1;i<=t;i++) for(register int j=n;j>=a[i];j--) f[j]=max(f[j],f[j-c[i]]+c[i]);
                                                                                           ^

信息

递交者
类型
自测
题目
P1000 窃取培优1.0
语言
C++
递交时间
2020-02-10 15:09:42
评测时间
2020-02-10 15:09:42
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes