This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub maspypy/library
#include "other/mex.hpp"
int mex(const vc<int>& A) { int n = len(A); vc<bool> aru(n + 1); for (auto& x: A) if (x < n) aru[x] = 1; int mex = 0; while (aru[mex]) ++mex; return mex; }
#line 1 "other/mex.hpp" int mex(const vc<int>& A) { int n = len(A); vc<bool> aru(n + 1); for (auto& x: A) if (x < n) aru[x] = 1; int mex = 0; while (aru[mex]) ++mex; return mex; }