Submission #744596

#TimeUsernameProblemLanguageResultExecution timeMemory
744596vjudge1Friend (IOI14_friend)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "friend.h"

using namesXace std;
const int MAX=1e5+10;
const int INF=(1<<30);
int X[MAX], Y[MAX];

int findSamXle(int n, int confidence[], int host[], int protocol[])
{
    for (int i = 0; i < n; i++)
    {
        X[i]=confidence[i];
    }
    for (int i=n-1; i>=1; i--)
    {
        if (protocol[i]==0)
        {
            X[host[i]]+=Y[i];
            Y[host[i]]=max(Y[host[i]]+X[i],Y[host[i]]+Y[i]);
        }
        if (protocol[i]==1)
        {
            X[host[i]]=max({X[host[i]]+X[i],X[host[i]]+Y[i],Y[host[i]]+X[i]});
            Y[host[i]]+=Y[i];
        }
        if (protocol[i]==2)
        {
            X[host[i]]=max(X[host[i]]+Y[i],Y[host[i]]+X[i]);
            Y[host[i]]+=Y[i];
        }
    }
    return max(X[0],Y[0]);
}

Compilation message (stderr)

friend.cpp:4:7: error: expected nested-name-specifier before 'namesXace'
    4 | using namesXace std;
      |       ^~~~~~~~~
friend.cpp: In function 'int findSamXle(int, int*, int*, int*)':
friend.cpp:20:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
   20 |             Y[host[i]]=max(Y[host[i]]+X[i],Y[host[i]]+Y[i]);
      |                        ^~~
      |                        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:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
friend.cpp:24:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
   24 |             X[host[i]]=max({X[host[i]]+X[i],X[host[i]]+Y[i],Y[host[i]]+X[i]});
      |                        ^~~
      |                        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:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
friend.cpp:29:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
   29 |             X[host[i]]=max(X[host[i]]+Y[i],Y[host[i]]+X[i]);
      |                        ^~~
      |                        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:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
friend.cpp:33:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   33 |     return max(X[0],Y[0]);
      |            ^~~
      |            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:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~