# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
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
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |