Submission #1129965

#TimeUsernameProblemLanguageResultExecution timeMemory
1129965mnbvcxz123Amusement Park (CEOI19_amusementpark)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; const int N = 18; const int M = 998244353; int a[N]; bool indepset[1 << N]; int popcnt[1 << N]; int arg[1 << N]; int nodeid[1 << N]; ll dp[1 << N]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= m; i++) { int u, v; cin >> u >> v; u--; v--; a[u] |= 1 << v; a[v] |= 1 << u; } for (int i = 0; i < n; i++) { nodeid[1 << i] = i; } for (int i = 0; i < (1 << n); i++) { popcnt[i] = popcnt[i >> 1] + (i & 1); arg[i] = (popcnt[i] % 2) * 2 - 1; } indepset[0] = 1; for (int i = 1; i < (1 << n); i++) { if (indepset[i & (i - 1)] && (a[nodeid[i & (-i)]] & (i & (i - 1))) == 0) { indepset[i] = true; } } f[0] = 1; for (int i = 1; i < (1 << n); i++) { for (int j = i; j; j = (j - 1) & i) { if (indepset[j]) { dp[i] = (dp[i] + arg[j] * dp[i ^ j]) % M; } } } dp[(1 << n) - 1] = (dp[(1 << n) - 1] + M) % M; cout << dp[(1 << n) - 1] * m % M * ((M + 1) / 2) % M; return 0; }

Compilation message (stderr)

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:27:17: error: reference to 'arg' is ambiguous
   27 |                 arg[i] = (popcnt[i] % 2) * 2 - 1;
      |                 ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from amusementpark.cpp:1:
/usr/include/c++/11/complex:1852:5: note: candidates are: 'template<class _Tp> typename __gnu_cxx::__promote<_Tp>::__type std::arg(_Tp)'
 1852 |     arg(_Tp __x)
      |     ^~~
/usr/include/c++/11/complex:653:5: note:                 'template<class _Tp> _Tp std::arg(const std::complex<_Tp>&)'
  653 |     arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }
      |     ^~~
amusementpark.cpp:10:5: note:                 'int arg [262144]'
   10 | int arg[1 << N];
      |     ^~~
amusementpark.cpp:35:9: error: 'f' was not declared in this scope
   35 |         f[0] = 1;
      |         ^
amusementpark.cpp:38:61: error: reference to 'arg' is ambiguous
   38 |                         if (indepset[j]) { dp[i] = (dp[i] + arg[j] * dp[i ^ j]) % M; }
      |                                                             ^~~
In file included from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from amusementpark.cpp:1:
/usr/include/c++/11/complex:1852:5: note: candidates are: 'template<class _Tp> typename __gnu_cxx::__promote<_Tp>::__type std::arg(_Tp)'
 1852 |     arg(_Tp __x)
      |     ^~~
/usr/include/c++/11/complex:653:5: note:                 'template<class _Tp> _Tp std::arg(const std::complex<_Tp>&)'
  653 |     arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }
      |     ^~~
amusementpark.cpp:10:5: note:                 'int arg [262144]'
   10 | int arg[1 << N];
      |     ^~~