F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_38776788_26034.cpp:5:8: error: reference to 'size' is ambiguous
    5 | int dp[size],w[size],v[size];
      |        ^~~~
In file included from gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/string:53,
                 from gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bitset:52,
                 from .\stdc++.h:52:
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:274:5: note: candidates are: 'template<class _Tp, long long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  274 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:264:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  264 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
0_0_38776788_26034.cpp:4:11: note:                 'const long long int size'
    4 | const int size=1e3+10;
      |           ^~~~
0_0_38776788_26034.cpp:5:16: error: reference to 'size' is ambiguous
    5 | int dp[size],w[size],v[size];
      |                ^~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:274:5: note: candidates are: 'template<class _Tp, long long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  274 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:264:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  264 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
0_0_38776788_26034.cpp:4:11: note:                 'const long long int size'
    4 | const int size=1e3+10;
      |           ^~~~
0_0_38776788_26034.cpp:5:24: error: reference to 'size' is ambiguous
    5 | int dp[size],w[size],v[size];
      |                        ^~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:274:5: note: candidates are: 'template<class _Tp, long long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  274 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
gcc-13.1.0/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/range_access.h:264:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  264 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
0_0_38776788_26034.cpp:4:11: note:                 'const long long int size'
    4 | const int size=1e3+10;
      |           ^~~~
0_0_38776788_26034.cpp: In function 'int main()':
0_0_38776788_26034.cpp:18:30: error: 'w' was not declared in this scope
   18 |                         cin>>w[i];
      |                              ^
0_0_38776788_26034.cpp:20:30: error: 'v' was not declared in this scope
   20 |                         cin>>v[i];
      |                              ^
0_0_38776788_26034.cpp:22:40: error: 'w' was not declared in this scope
   22 |                         for(int j=m;j>=w[i];j--)
      |                                        ^
0_0_38776788_26034.cpp:23:33: error: 'dp' was not declared in this scope
   23 |                                 dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
      |                                 ^~
0_0_38776788_26034.cpp:23:60: error: 'v' was not declared in this scope
   23 |                                 dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
      |                                                            ^
0_0_38776788_26034.cpp:24:23: error: 'dp' was not declared in this scope
   24 |                 cout<<dp[m]<<endl;
      |                       ^~


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-09-29 10:26:56, Gzip enabled