# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
608833 | 2022-07-27T10:37:38 Z | 1bin | Amusement Park (CEOI19_amusementpark) | C++14 | 9 ms | 12632 KB |
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const ll mod = 998244353; ll n, m, a, b, e[18]; map<int, ll> dp[1 << 18]; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 0; i < m; i++){ cin >> a >> b; a--; b--; e[a] |= 1 << b; e[b] |= 1 << a; } dp[0][(1 << n) - 1] = 1; for(int a = 0; a < 1 << n; a++) for(auto& [b, x] : dp[a]){ for(int i = 0; i < n; i++){ if(!(b & (1 << i))) continue; int nxa = a | (1 << i); int nxb = (b ^ (1 << i)) | (e[i] & ((1 << n) - 1 - a)); dp[nxa][nxb] += x; dp[nxa][nxb] %= mod; } } cout << dp[(1 << n) - 1][0] * m % mod * (mod + 1) / 2 % mod; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12628 KB | Output is correct |
2 | Correct | 6 ms | 12632 KB | Output is correct |
3 | Incorrect | 9 ms | 12628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12628 KB | Output is correct |
2 | Correct | 6 ms | 12632 KB | Output is correct |
3 | Incorrect | 9 ms | 12628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12628 KB | Output is correct |
2 | Correct | 6 ms | 12632 KB | Output is correct |
3 | Incorrect | 9 ms | 12628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12628 KB | Output is correct |
2 | Correct | 6 ms | 12632 KB | Output is correct |
3 | Incorrect | 9 ms | 12628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12628 KB | Output is correct |
2 | Correct | 6 ms | 12632 KB | Output is correct |
3 | Incorrect | 9 ms | 12628 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |