记录详情

Compile Error

foo.cc:10:19: error: 'int time [150]' redeclared as different kind of symbol
 int a[25],time[150];
                   ^
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/gthr.h:148,
                 from /usr/include/c++/7/ext/atomicity.h:35,
                 from /usr/include/c++/7/bits/ios_base.h:39,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from foo.cc:1:
/usr/include/time.h:75:15: note: previous declaration 'time_t time(time_t*)'
 extern time_t time (time_t *__timer) __THROW;
               ^~~~
foo.cc: In function 'void dfs(int)':
foo.cc:15:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                         ^
foo.cc:15:58: error: no matching function for call to 'max(int&, time_t (&)(time_t*) throw ())'
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from foo.cc:1:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
foo.cc:15:58: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) throw () {aka long int(long int*) throw ()}')
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from foo.cc:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
foo.cc:15:58: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) throw () {aka long int(long int*) throw ()}')
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from foo.cc:2:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
foo.cc:15:58: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from foo.cc:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
foo.cc:15:58: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   for(int i = 1;i <= n;++ i)maxtime = max(maxtime,time[i]);
                                                          ^
foo.cc:19:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   time[i] += a[i];
         ^
foo.cc:19:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   time[i] += a[i];
   ~~~~~~~~^~~~~~~
foo.cc:19:17: error: assignment of read-only location '*(time + ((sizetype)i))'
   time[i] += a[i];
                 ^
foo.cc:19:17: error: cannot convert 'time_t (*)(time_t*) throw () {aka long int (*)(long int*) throw ()}' to 'time_t(time_t*) throw () {aka long int(long int*) throw ()}' in assignment
foo.cc:21:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   time[i] -= a[i];
         ^
foo.cc:21:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   time[i] -= a[i];
   ~~~~~~~~^~~~~~~
foo.cc:21:17: error: assignment of read-only location '*(time + ((sizetype)i))'
   time[i] -= a[i];
                 ^
foo.cc:21:17: error: cannot convert 'time_t (*)(time_t*) throw () {aka long int (*)(long int*) throw ()}' to 'time_t(time_t*) throw () {aka long int(long int*) throw ()}' in assignment
foo.cc: In function 'int main()':
foo.cc:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&k);
  ~~~~~^~~~~~~~~~~~~~
foo.cc:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i]);
   ~~~~~^~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
最佳调度问题
题目数据
下载
语言
C++
递交时间
2021-10-19 16:38:06
评测时间
2021-10-19 16:38:06
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes