제출 #874021

#제출 시각아이디문제언어결과실행 시간메모리
874021OSoverspikeFriend (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include "friend.h" #include <bits/stdc++.h> // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ int ans=0; if (protocol[1]==1) { for (int a=0; a<=n; a++) { ans+=confidence[a]; } } else { for (int a=0; a<=n; a++) { ans=max(ans, confidence[a]); } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:12:17: error: 'max' was not declared in this scope; did you mean 'std::max'?
   12 |             ans=max(ans, confidence[a]);
      |                 ^~~
      |                 std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from friend.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~