# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
304142 | 2020-09-21T03:29:41 Z | Hemimor | Paths (BOI18_paths) | C++14 | 674 ms | 70904 KB |
#include <algorithm> #include <iostream> #include <iomanip> #include <numeric> #include <cassert> #include <vector> #include <cmath> #include <queue> #include <stack> #include <set> #include <map> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<P,int> pip; typedef vector<pip> vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; int n,m,k; vi a; vvi g; vvl dp; int main(){ scanf("%d%d%d",&n,&m,&k); a=vi(n); g=vvi(n); dp=vvl(n,vl(1<<k)); for(int i=0;i<n;i++){ cin>>a[i]; a[i]--; dp[i][1<<a[i]]++; } for(int i=0;i<m;i++){ int u,v; scanf("%d%d",&u,&v); u--,v--; g[u].push_back(v); g[v].push_back(u); } ll res=-n; for(int i=1;i<1<<k;i++) for(int v=0;v<n;v++) if(dp[v][i]){ for(auto u:g[v]) if(!(i&1<<a[u])) dp[u][i+(1<<a[u])]+=dp[v][i]; } for(int i=0;i<n;i++) for(int j=0;j<1<<k;j++) res+=dp[i][j]; printf("%lld\n",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 122 ms | 7416 KB | Output is correct |
2 | Correct | 105 ms | 6140 KB | Output is correct |
3 | Correct | 551 ms | 52088 KB | Output is correct |
4 | Correct | 167 ms | 11000 KB | Output is correct |
5 | Correct | 153 ms | 10616 KB | Output is correct |
6 | Correct | 373 ms | 37356 KB | Output is correct |
7 | Correct | 528 ms | 52088 KB | Output is correct |
8 | Correct | 522 ms | 52556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 256 KB | Output is correct |
11 | Correct | 122 ms | 7416 KB | Output is correct |
12 | Correct | 105 ms | 6140 KB | Output is correct |
13 | Correct | 551 ms | 52088 KB | Output is correct |
14 | Correct | 167 ms | 11000 KB | Output is correct |
15 | Correct | 153 ms | 10616 KB | Output is correct |
16 | Correct | 373 ms | 37356 KB | Output is correct |
17 | Correct | 528 ms | 52088 KB | Output is correct |
18 | Correct | 522 ms | 52556 KB | Output is correct |
19 | Correct | 119 ms | 7416 KB | Output is correct |
20 | Correct | 100 ms | 6140 KB | Output is correct |
21 | Correct | 534 ms | 51960 KB | Output is correct |
22 | Correct | 175 ms | 11000 KB | Output is correct |
23 | Correct | 151 ms | 10616 KB | Output is correct |
24 | Correct | 379 ms | 37484 KB | Output is correct |
25 | Correct | 524 ms | 51964 KB | Output is correct |
26 | Correct | 512 ms | 52728 KB | Output is correct |
27 | Correct | 117 ms | 6264 KB | Output is correct |
28 | Correct | 161 ms | 9080 KB | Output is correct |
29 | Correct | 671 ms | 70904 KB | Output is correct |
30 | Correct | 468 ms | 38892 KB | Output is correct |
31 | Correct | 493 ms | 38896 KB | Output is correct |
32 | Correct | 674 ms | 70784 KB | Output is correct |
33 | Correct | 1 ms | 384 KB | Output is correct |
34 | Correct | 1 ms | 384 KB | Output is correct |
35 | Correct | 1 ms | 384 KB | Output is correct |
36 | Correct | 1 ms | 384 KB | Output is correct |
37 | Correct | 1 ms | 384 KB | Output is correct |
38 | Correct | 1 ms | 384 KB | Output is correct |
39 | Correct | 1 ms | 384 KB | Output is correct |
40 | Correct | 1 ms | 384 KB | Output is correct |
41 | Correct | 1 ms | 256 KB | Output is correct |
42 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 52 ms | 2424 KB | Output is correct |
3 | Correct | 33 ms | 2168 KB | Output is correct |
4 | Correct | 152 ms | 17400 KB | Output is correct |
5 | Correct | 106 ms | 18160 KB | Output is correct |
6 | Correct | 254 ms | 36240 KB | Output is correct |
7 | Correct | 37 ms | 2176 KB | Output is correct |
8 | Correct | 184 ms | 23672 KB | Output is correct |
9 | Correct | 135 ms | 24432 KB | Output is correct |
10 | Correct | 160 ms | 24512 KB | Output is correct |
11 | Correct | 143 ms | 19188 KB | Output is correct |
12 | Correct | 145 ms | 28276 KB | Output is correct |
13 | Correct | 136 ms | 19320 KB | Output is correct |
14 | Correct | 245 ms | 36344 KB | Output is correct |
15 | Correct | 231 ms | 36216 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 256 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 256 KB | Output is correct |
25 | Correct | 1 ms | 256 KB | Output is correct |