# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
991811 | 2024-06-03T07:47:15 Z | vjudge1 | Amusement Park (CEOI19_amusementpark) | C++17 | 1 ms | 396 KB |
#include<bits/stdc++.h> using namespace std; int has[18][18],indep[1<<18]; long long dp[1<<18],mod=998244353; long long ans; int main(){ int n,m; cin>>n>>m; for(int i=0;i<m;i++){ int x,y; cin>>x>>y; x--,y--; has[x][y]=1; has[y][x]=1; } for(int i=0;i<1<<n;i++){ vector<int>v; for(int j=0;j<n;j++) if(i&1<<j) v.push_back(j); for(int j=0;j<v.size();j++) for(int k=j+1;k<v.size();k++) indep[i]|=has[j][k]; indep[i]^=1; } dp[0]=1; for(int i=1;i<1<<n;i++) for(int j=i-1&i;;j=j-1&i){ int cnt=__builtin_popcount(i^j); dp[i]=(dp[i]+mod+indep[i-j]*dp[j]*(cnt%2*2-1))%mod; if(!j) break; } cout<<(mod+1)/2*dp[(1<<n)-1]%mod*m%mod; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 396 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 396 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 396 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 396 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Incorrect | 0 ms | 396 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |