Submission #313638

#TimeUsernameProblemLanguageResultExecution timeMemory
313638tengiz05친구 (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include "friend.h" #include <algorithm> int ans,i; int findSample(int n,int c[],int h[],int p[]){ for(i=n;--i;){ if(p[i]==0)ans+=c[i],c[h[i]]=max(0,c[h[i]]-c[i]); if(p[i]==1)c[h[i]]+=c[i]; if(p[i]==2)c[h[i]]=max(c[h[i]],c[i]); }return ans+c[0]; }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:6:32: error: 'max' was not declared in this scope; did you mean 'std::max'?
    6 |   if(p[i]==0)ans+=c[i],c[h[i]]=max(0,c[h[i]]-c[i]);
      |                                ^~~
      |                                std::max
In file included from /usr/include/c++/9/algorithm:62,
                 from friend.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: 'std::max' declared here
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
friend.cpp:8:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
    8 |   if(p[i]==2)c[h[i]]=max(c[h[i]],c[i]);
      |                      ^~~
      |                      std::max
In file included from /usr/include/c++/9/algorithm:62,
                 from friend.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: 'std::max' declared here
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~