# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537878 |
2022-03-15T18:36:42 Z |
__Variatto |
Paths (BOI18_paths) |
C++17 |
|
146 ms |
30540 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<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 |
2772 KB |
Output is correct |
3 |
Correct |
2 ms |
2812 KB |
Output is correct |
4 |
Correct |
2 ms |
2772 KB |
Output is correct |
5 |
Correct |
1 ms |
2772 KB |
Output is correct |
6 |
Correct |
2 ms |
2772 KB |
Output is correct |
7 |
Correct |
2 ms |
2772 KB |
Output is correct |
8 |
Correct |
2 ms |
2772 KB |
Output is correct |
9 |
Correct |
2 ms |
2772 KB |
Output is correct |
10 |
Correct |
1 ms |
2772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
7596 KB |
Output is correct |
2 |
Correct |
50 ms |
6552 KB |
Output is correct |
3 |
Runtime error |
20 ms |
9944 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 |
2772 KB |
Output is correct |
3 |
Correct |
2 ms |
2812 KB |
Output is correct |
4 |
Correct |
2 ms |
2772 KB |
Output is correct |
5 |
Correct |
1 ms |
2772 KB |
Output is correct |
6 |
Correct |
2 ms |
2772 KB |
Output is correct |
7 |
Correct |
2 ms |
2772 KB |
Output is correct |
8 |
Correct |
2 ms |
2772 KB |
Output is correct |
9 |
Correct |
2 ms |
2772 KB |
Output is correct |
10 |
Correct |
1 ms |
2772 KB |
Output is correct |
11 |
Correct |
69 ms |
7596 KB |
Output is correct |
12 |
Correct |
50 ms |
6552 KB |
Output is correct |
13 |
Runtime error |
20 ms |
9944 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 |
20 ms |
4044 KB |
Output is correct |
3 |
Correct |
22 ms |
3956 KB |
Output is correct |
4 |
Correct |
146 ms |
28168 KB |
Output is correct |
5 |
Correct |
84 ms |
28844 KB |
Output is correct |
6 |
Correct |
127 ms |
30476 KB |
Output is correct |
7 |
Correct |
20 ms |
4060 KB |
Output is correct |
8 |
Correct |
142 ms |
29664 KB |
Output is correct |
9 |
Correct |
84 ms |
30376 KB |
Output is correct |
10 |
Correct |
95 ms |
28792 KB |
Output is correct |
11 |
Correct |
62 ms |
17152 KB |
Output is correct |
12 |
Correct |
84 ms |
22576 KB |
Output is correct |
13 |
Correct |
69 ms |
15984 KB |
Output is correct |
14 |
Correct |
122 ms |
30412 KB |
Output is correct |
15 |
Correct |
122 ms |
30540 KB |
Output is correct |
16 |
Correct |
2 ms |
2772 KB |
Output is correct |
17 |
Correct |
2 ms |
2772 KB |
Output is correct |
18 |
Correct |
2 ms |
2772 KB |
Output is correct |
19 |
Correct |
1 ms |
2772 KB |
Output is correct |
20 |
Correct |
2 ms |
2772 KB |
Output is correct |
21 |
Correct |
2 ms |
2772 KB |
Output is correct |
22 |
Correct |
2 ms |
2772 KB |
Output is correct |
23 |
Correct |
3 ms |
2772 KB |
Output is correct |
24 |
Correct |
2 ms |
2772 KB |
Output is correct |
25 |
Correct |
2 ms |
2772 KB |
Output is correct |