Submission #98517

#TimeUsernameProblemLanguageResultExecution timeMemory
98517pamajZoltan (COCI16_zoltan)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t const int mod = 1e9 + 7; int v[100010]; int n; map<int, int> mp; set<int> st; int exp(int x, unsigned int y, int p) { int res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p; } return res; } int main() { cin >> n; for(int i = 0; i < n; i++) { cin >> v[i]; mp[v[i]]++; st.insert(v[i]); } long long ans = 1; for(auto u : st) { ans *= exp(2, mp[u], mod); ans %= mod; } cout << st.size() << " " << ans << "\n"; }

Compilation message (stderr)

zoltan.cpp:10:29: error: expected ',' or '...' before 'y'
 int exp(int x, unsigned int y, int p) 
                             ^
zoltan.cpp: In function 'int64_t exp(int64_t, unsigned int)':
zoltan.cpp:12:9: error: expected ';' before 'res'
     int res = 1;
         ^~~
zoltan.cpp:12:16: warning: statement has no effect [-Wunused-value]
     int res = 1;
                ^
zoltan.cpp:14:13: error: 'p' was not declared in this scope
     x = x % p; 
             ^
zoltan.cpp:16:12: error: 'y' was not declared in this scope
     while (y > 0) 
            ^
zoltan.cpp:19:13: error: 'res' was not declared in this scope
             res = (res*x) % p; 
             ^~~
zoltan.cpp:24:12: error: 'res' was not declared in this scope
     return res; 
            ^~~
zoltan.cpp: At global scope:
zoltan.cpp:27:10: error: '::main' must return 'int'
 int main()
          ^
zoltan.cpp: In function 'int main()':
zoltan.cpp:43:27: error: no matching function for call to 'exp(int, std::map<long int, long int>::mapped_type&, const int64_t&)'
   ans *= exp(2, mp[u], mod);
                           ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from zoltan.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:100:1: note: candidate: double exp(double)
 __MATHCALL_VEC (exp,, (_Mdouble_ __x));
 ^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:100:1: note:   candidate expects 1 argument, 3 provided
zoltan.cpp:10:5: note: candidate: int64_t exp(int64_t, unsigned int)
 int exp(int x, unsigned int y, int p) 
     ^~~
zoltan.cpp:10:5: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41:0,
                 from zoltan.cpp:1:
/usr/include/c++/7/cmath:222:3: note: candidate: constexpr float std::exp(float)
   exp(float __x)
   ^~~
/usr/include/c++/7/cmath:222:3: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/7/cmath:226:3: note: candidate: constexpr long double std::exp(long double)
   exp(long double __x)
   ^~~
/usr/include/c++/7/cmath:226:3: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/7/cmath:234:5: note: candidate: template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::exp(_Tp)
     exp(_Tp __x)
     ^~~
/usr/include/c++/7/cmath:234:5: note:   template argument deduction/substitution failed:
zoltan.cpp:43:27: note:   candidate expects 1 argument, 3 provided
   ans *= exp(2, mp[u], mod);
                           ^
In file included from /usr/include/c++/7/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from zoltan.cpp:1:
/usr/include/c++/7/complex:763:5: note: candidate: template<class _Tp> std::complex<_Tp> std::exp(const std::complex<_Tp>&)
     exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); }
     ^~~
/usr/include/c++/7/complex:763:5: note:   template argument deduction/substitution failed:
zoltan.cpp:43:27: note:   mismatched types 'const std::complex<_Tp>' and 'int'
   ans *= exp(2, mp[u], mod);
                           ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from zoltan.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:452:5: note: candidate: template<class _Dom> std::_Expr<std::_UnClos<std::_Exp, std::_Expr, _Dom>, typename _Dom::value_type> std::exp(const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp)
     ^
/usr/include/c++/7/bits/valarray_after.h:452:5: note:   template argument deduction/substitution failed:
zoltan.cpp:43:27: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
   ans *= exp(2, mp[u], mod);
                           ^
In file included from /usr/include/c++/7/valarray:592:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95,
                 from zoltan.cpp:1:
/usr/include/c++/7/bits/valarray_after.h:452:5: note: candidate: template<class _Tp> std::_Expr<std::_UnClos<std::_Exp, std::_ValArray, _Tp>, _Tp> std::exp(const std::valarray<_Tp>&)
     _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp)
     ^
/usr/include/c++/7/bits/valarray_after.h:452:5: note:   template argument deduction/substitution failed:
zoltan.cpp:43:27: note:   mismatched types 'const std::valarray<_Tp>' and 'int'
   ans *= exp(2, mp[u], mod);
                           ^