Submission #874021

# Submission time Handle Problem Language Result Execution time Memory
874021 2023-11-16T07:54:55 Z OSoverspike Friend (IOI14_friend) C++17
Compilation error
0 ms 0 KB
#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;
}

Compilation message

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)
      |     ^~~