# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537879 |
2022-03-15T18:37:42 Z |
__Variatto |
Paths (BOI18_paths) |
C++17 |
|
148 ms |
30592 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=1e5+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 |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
1 ms |
2644 KB |
Output is correct |
10 |
Correct |
1 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
6648 KB |
Output is correct |
2 |
Correct |
44 ms |
6304 KB |
Output is correct |
3 |
Runtime error |
24 ms |
9940 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
1 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2644 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
1 ms |
2644 KB |
Output is correct |
10 |
Correct |
1 ms |
2644 KB |
Output is correct |
11 |
Correct |
55 ms |
6648 KB |
Output is correct |
12 |
Correct |
44 ms |
6304 KB |
Output is correct |
13 |
Runtime error |
24 ms |
9940 KB |
Execution killed with signal 11 |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
24 ms |
4052 KB |
Output is correct |
3 |
Correct |
17 ms |
3800 KB |
Output is correct |
4 |
Correct |
58 ms |
11780 KB |
Output is correct |
5 |
Correct |
63 ms |
12364 KB |
Output is correct |
6 |
Correct |
124 ms |
30504 KB |
Output is correct |
7 |
Correct |
19 ms |
3944 KB |
Output is correct |
8 |
Correct |
125 ms |
17920 KB |
Output is correct |
9 |
Correct |
82 ms |
18724 KB |
Output is correct |
10 |
Correct |
63 ms |
17708 KB |
Output is correct |
11 |
Correct |
58 ms |
17148 KB |
Output is correct |
12 |
Correct |
61 ms |
22540 KB |
Output is correct |
13 |
Correct |
79 ms |
16016 KB |
Output is correct |
14 |
Correct |
148 ms |
30440 KB |
Output is correct |
15 |
Correct |
124 ms |
30592 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
1 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2644 KB |
Output is correct |
23 |
Correct |
2 ms |
2772 KB |
Output is correct |
24 |
Correct |
2 ms |
2644 KB |
Output is correct |
25 |
Correct |
2 ms |
2644 KB |
Output is correct |