| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 729043 | Rafi22 | Amusement Park (CEOI19_amusementpark) | C++14 | 1915 ms | 246276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=998244353;
int inf=1000000007;
ll infl=1000000000000000007;
const int N=18;
unordered_map<int,int>DP[(1<<N)];
vector<int>inside[(1<<N)];
int G[N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m,a,b;
cin>>n>>m;
for(int i=0;i<m;i++)
{
cin>>a>>b;
a--,b--;
G[a]^=(1<<b);
G[b]^=(1<<a);
}
for(int i=0;i<(1<<n);i++)
{
for(int j=0;j<n;j++) if(i&(1<<j)) inside[i].pb(j);
}
DP[0][(1<<n)-1]=1;
for(int a=0;a<(1<<n);a++)
{
int d=(1<<n)-1-a;
for(auto [b,x]:DP[a])
{
for(auto k:inside[b])
{
int A=a^(1<<k),B=(b&((1<<n)-(1<<(k+1))))|(G[k]&((1<<n)-1-a-(1<<k)));
int y=DP[A][B];
y+=x;
if(y>=mod) y-=mod;
DP[A][B]=y;
}
}
}
cout<<(ll)DP[(1<<n)-1][0]*(ll)m%mod*499122177%mod;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
