# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537880 |
2022-03-15T18:42:36 Z |
__Variatto |
Paths (BOI18_paths) |
C++17 |
|
402 ms |
57764 KB |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=3e5+10, K=1<<5;
ll n, m, k, dp[K+2][MAX], kol[MAX];
vector<int>g[MAX];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin>>n>>m>>k;
for(int i=1; i<=n; i++)
cin>>kol[i];
for(int i=1; i<=m; i++){
int a,b;
cin>>a>>b;
g[a].pb(b), g[b].pb(a);
}
ll wyn=0;
for(int i=1; i<(1<<k); i++){
for(int v=1; v<=n; v++){
if(!(i&(1<<(kol[v]-1)))) continue;
if(__builtin_popcount(i)==1)
dp[i][v]=1;
//cout<<i<<" "<<kol[v]<<"\n";
for(auto s:g[v])
dp[i][v]+=dp[i-(1<<(kol[v]-1))][s];
if(__builtin_popcount(i)>1)
wyn+=dp[i][v];
}
}
cout<<wyn<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7380 KB |
Output is correct |
2 |
Correct |
4 ms |
7508 KB |
Output is correct |
3 |
Correct |
4 ms |
7380 KB |
Output is correct |
4 |
Correct |
4 ms |
7380 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7508 KB |
Output is correct |
7 |
Correct |
4 ms |
7508 KB |
Output is correct |
8 |
Correct |
4 ms |
7508 KB |
Output is correct |
9 |
Correct |
4 ms |
7380 KB |
Output is correct |
10 |
Correct |
4 ms |
7356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
11372 KB |
Output is correct |
2 |
Correct |
61 ms |
10956 KB |
Output is correct |
3 |
Correct |
256 ms |
38244 KB |
Output is correct |
4 |
Correct |
106 ms |
15988 KB |
Output is correct |
5 |
Correct |
109 ms |
15608 KB |
Output is correct |
6 |
Correct |
201 ms |
31084 KB |
Output is correct |
7 |
Correct |
316 ms |
39000 KB |
Output is correct |
8 |
Correct |
281 ms |
39600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7380 KB |
Output is correct |
2 |
Correct |
4 ms |
7508 KB |
Output is correct |
3 |
Correct |
4 ms |
7380 KB |
Output is correct |
4 |
Correct |
4 ms |
7380 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7508 KB |
Output is correct |
7 |
Correct |
4 ms |
7508 KB |
Output is correct |
8 |
Correct |
4 ms |
7508 KB |
Output is correct |
9 |
Correct |
4 ms |
7380 KB |
Output is correct |
10 |
Correct |
4 ms |
7356 KB |
Output is correct |
11 |
Correct |
89 ms |
11372 KB |
Output is correct |
12 |
Correct |
61 ms |
10956 KB |
Output is correct |
13 |
Correct |
256 ms |
38244 KB |
Output is correct |
14 |
Correct |
106 ms |
15988 KB |
Output is correct |
15 |
Correct |
109 ms |
15608 KB |
Output is correct |
16 |
Correct |
201 ms |
31084 KB |
Output is correct |
17 |
Correct |
316 ms |
39000 KB |
Output is correct |
18 |
Correct |
281 ms |
39600 KB |
Output is correct |
19 |
Correct |
71 ms |
14176 KB |
Output is correct |
20 |
Correct |
71 ms |
13276 KB |
Output is correct |
21 |
Correct |
288 ms |
39016 KB |
Output is correct |
22 |
Correct |
112 ms |
16108 KB |
Output is correct |
23 |
Correct |
113 ms |
15580 KB |
Output is correct |
24 |
Correct |
184 ms |
31092 KB |
Output is correct |
25 |
Correct |
281 ms |
38964 KB |
Output is correct |
26 |
Correct |
313 ms |
39664 KB |
Output is correct |
27 |
Correct |
52 ms |
13452 KB |
Output is correct |
28 |
Correct |
68 ms |
15724 KB |
Output is correct |
29 |
Correct |
402 ms |
57764 KB |
Output is correct |
30 |
Correct |
210 ms |
36112 KB |
Output is correct |
31 |
Correct |
229 ms |
34948 KB |
Output is correct |
32 |
Correct |
397 ms |
57728 KB |
Output is correct |
33 |
Correct |
4 ms |
7508 KB |
Output is correct |
34 |
Correct |
5 ms |
7524 KB |
Output is correct |
35 |
Correct |
4 ms |
7380 KB |
Output is correct |
36 |
Correct |
4 ms |
7376 KB |
Output is correct |
37 |
Correct |
4 ms |
7380 KB |
Output is correct |
38 |
Correct |
5 ms |
7512 KB |
Output is correct |
39 |
Correct |
5 ms |
7508 KB |
Output is correct |
40 |
Correct |
5 ms |
7496 KB |
Output is correct |
41 |
Correct |
4 ms |
7380 KB |
Output is correct |
42 |
Correct |
5 ms |
7380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7508 KB |
Output is correct |
2 |
Correct |
19 ms |
8772 KB |
Output is correct |
3 |
Correct |
17 ms |
8456 KB |
Output is correct |
4 |
Correct |
56 ms |
16392 KB |
Output is correct |
5 |
Correct |
45 ms |
17200 KB |
Output is correct |
6 |
Correct |
173 ms |
35420 KB |
Output is correct |
7 |
Correct |
30 ms |
8676 KB |
Output is correct |
8 |
Correct |
93 ms |
22676 KB |
Output is correct |
9 |
Correct |
57 ms |
23508 KB |
Output is correct |
10 |
Correct |
71 ms |
22624 KB |
Output is correct |
11 |
Correct |
64 ms |
21860 KB |
Output is correct |
12 |
Correct |
101 ms |
27368 KB |
Output is correct |
13 |
Correct |
77 ms |
20764 KB |
Output is correct |
14 |
Correct |
126 ms |
35384 KB |
Output is correct |
15 |
Correct |
134 ms |
35408 KB |
Output is correct |
16 |
Correct |
5 ms |
7380 KB |
Output is correct |
17 |
Correct |
6 ms |
7508 KB |
Output is correct |
18 |
Correct |
4 ms |
7448 KB |
Output is correct |
19 |
Correct |
4 ms |
7380 KB |
Output is correct |
20 |
Correct |
4 ms |
7380 KB |
Output is correct |
21 |
Correct |
4 ms |
7508 KB |
Output is correct |
22 |
Correct |
4 ms |
7508 KB |
Output is correct |
23 |
Correct |
6 ms |
7508 KB |
Output is correct |
24 |
Correct |
4 ms |
7380 KB |
Output is correct |
25 |
Correct |
4 ms |
7380 KB |
Output is correct |