/ Vijos /

记录详情

Compile Error

/in/foo.cc:18:5: error: 'int time' redeclared as different kind of symbol
 int time=0;
     ^~~~
In file included from /usr/include/pthread.h:24:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/gthr.h:148,
                 from /usr/include/c++/6/ext/atomicity.h:35,
                 from /usr/include/c++/6/bits/ios_base.h:39,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/time.h:192:15: note: previous declaration 'time_t time(time_t*)'
 extern time_t time (time_t *__timer) __THROW;
               ^~~~
/in/foo.cc: In function 'void loop(int)':
/in/foo.cc:38:11: error: assignment of function 'time_t time(time_t*)'
      time=0;
           ^
/in/foo.cc:38:11: error: cannot convert 'int' to 'time_t(time_t*) throw () {aka long int(long int*) throw ()}' in assignment
/in/foo.cc:50:24: warning: the address of 'time_t time(time_t*)' will never be NULL [-Waddress]
         if(son==s&&time!=0)flag=1; 
                    ~~~~^~~
/in/foo.cc:51:22: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) throw () {aka long int (*)(long int*) throw ()}' [-Wpointer-arith]
         if(!flag)time++,vis[x]=3;
                      ^~
/in/foo.cc:51:22: error: lvalue required as increment operand
/in/foo.cc: In function 'int main()':
/in/foo.cc:76:27: error: no matching function for call to 'min(int&, time_t (&)(time_t*) throw ())'
         anss=min(anss,time);
                           ^
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                 from /usr/include/c++/6/ios:40,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/6/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
/in/foo.cc:76:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) throw () {aka long int(long int*) throw ()}')
         anss=min(anss,time);
                           ^
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
                 from /usr/include/c++/6/ios:40,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/6/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
/in/foo.cc:76:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) throw () {aka long int(long int*) throw ()}')
         anss=min(anss,time);
                           ^
In file included from /usr/include/c++/6/algorithm:62:0,
                 from /in/foo.cc:5:
/usr/include/c++/6/bits/stl_algo.h:3447:5: note: candidate: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/6/bits/stl_algo.h:3447:5: note:   template argument deduction/substitution failed:
/in/foo.cc:76:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
         anss=min(anss,time);
                           ^
In file included from /usr/include/c++/6/algorithm:62:0,
                 from /in/foo.cc:5:
/usr/include/c++/6/bits/stl_algo.h:3453:5: note: candidate: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/6/bits/stl_algo.h:3453:5: note:   template argument deduction/substitution failed:
/in/foo.cc:76:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
         anss=min(anss,time);
                           ^

信息

递交者
类型
递交
题目
P1979 信息传递
语言
C++
递交时间
2018-02-24 10:08:22
评测时间
2018-02-24 10:08:22
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes