# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
869224 |
2023-11-03T14:25:02 Z |
sleepntsheep |
Paths (BOI18_paths) |
C++17 |
|
530 ms |
397536 KB |
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using ll = long long;
#define N 300005
int n, m, k, c[N];
ll d[6][N][33],z;
array<int, 2> el[N];
int main()
{
ShinLena;
cin >> n >> m >> k;
for (int i = 1; i <= n; ++i) cin >> c[i], d[0][i][1<<--c[i]] = 1;
for (int i = 0; i < m; ++i) cin >> el[i][0] >> el[i][1];
for (int i = 1; i <= k; ++i)
{
for (int j = 0; j < m; ++j)
{
auto [u, v] = el[j];
for (int J = 2; J--; swap(u, v))
for (int s = 0; s < (1<<k); ++s) d[i][v][s|(1<<c[v])] += !((s>>c[v])&1)*d[i-1][u][s];
}
}
for (int j = 1; j <= k; ++j) for (int i = 1; i <= n; ++i) for (int s = 0; s < (1 << k); ++s) z += d[j][i][s];
cout << z;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
12632 KB |
Output is correct |
2 |
Correct |
1 ms |
12888 KB |
Output is correct |
3 |
Correct |
1 ms |
10588 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12632 KB |
Output is correct |
8 |
Correct |
1 ms |
12636 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
1 ms |
10588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
19708 KB |
Output is correct |
2 |
Correct |
48 ms |
15196 KB |
Output is correct |
3 |
Correct |
254 ms |
321528 KB |
Output is correct |
4 |
Correct |
58 ms |
36612 KB |
Output is correct |
5 |
Correct |
44 ms |
26504 KB |
Output is correct |
6 |
Correct |
211 ms |
222112 KB |
Output is correct |
7 |
Correct |
243 ms |
321372 KB |
Output is correct |
8 |
Correct |
246 ms |
321484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
12632 KB |
Output is correct |
2 |
Correct |
1 ms |
12888 KB |
Output is correct |
3 |
Correct |
1 ms |
10588 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
12636 KB |
Output is correct |
7 |
Correct |
2 ms |
12632 KB |
Output is correct |
8 |
Correct |
1 ms |
12636 KB |
Output is correct |
9 |
Correct |
1 ms |
12636 KB |
Output is correct |
10 |
Correct |
1 ms |
10588 KB |
Output is correct |
11 |
Correct |
59 ms |
19708 KB |
Output is correct |
12 |
Correct |
48 ms |
15196 KB |
Output is correct |
13 |
Correct |
254 ms |
321528 KB |
Output is correct |
14 |
Correct |
58 ms |
36612 KB |
Output is correct |
15 |
Correct |
44 ms |
26504 KB |
Output is correct |
16 |
Correct |
211 ms |
222112 KB |
Output is correct |
17 |
Correct |
243 ms |
321372 KB |
Output is correct |
18 |
Correct |
246 ms |
321484 KB |
Output is correct |
19 |
Correct |
62 ms |
19852 KB |
Output is correct |
20 |
Correct |
48 ms |
15092 KB |
Output is correct |
21 |
Correct |
253 ms |
321616 KB |
Output is correct |
22 |
Correct |
54 ms |
36688 KB |
Output is correct |
23 |
Correct |
45 ms |
26448 KB |
Output is correct |
24 |
Correct |
208 ms |
222296 KB |
Output is correct |
25 |
Correct |
241 ms |
321360 KB |
Output is correct |
26 |
Correct |
243 ms |
321360 KB |
Output is correct |
27 |
Correct |
76 ms |
17240 KB |
Output is correct |
28 |
Correct |
105 ms |
27984 KB |
Output is correct |
29 |
Correct |
523 ms |
397396 KB |
Output is correct |
30 |
Correct |
410 ms |
212036 KB |
Output is correct |
31 |
Correct |
436 ms |
211796 KB |
Output is correct |
32 |
Correct |
530 ms |
397536 KB |
Output is correct |
33 |
Correct |
2 ms |
12632 KB |
Output is correct |
34 |
Correct |
2 ms |
12636 KB |
Output is correct |
35 |
Correct |
1 ms |
10588 KB |
Output is correct |
36 |
Correct |
1 ms |
8540 KB |
Output is correct |
37 |
Correct |
1 ms |
6748 KB |
Output is correct |
38 |
Correct |
2 ms |
12636 KB |
Output is correct |
39 |
Correct |
2 ms |
12636 KB |
Output is correct |
40 |
Correct |
1 ms |
12636 KB |
Output is correct |
41 |
Correct |
1 ms |
12636 KB |
Output is correct |
42 |
Correct |
1 ms |
10588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14880 KB |
Output is correct |
2 |
Correct |
48 ms |
17792 KB |
Output is correct |
3 |
Correct |
17 ms |
13660 KB |
Output is correct |
4 |
Correct |
75 ms |
116888 KB |
Output is correct |
5 |
Correct |
75 ms |
116804 KB |
Output is correct |
6 |
Correct |
218 ms |
172204 KB |
Output is correct |
7 |
Correct |
26 ms |
15696 KB |
Output is correct |
8 |
Correct |
153 ms |
143440 KB |
Output is correct |
9 |
Correct |
138 ms |
143400 KB |
Output is correct |
10 |
Correct |
140 ms |
143444 KB |
Output is correct |
11 |
Correct |
138 ms |
96040 KB |
Output is correct |
12 |
Correct |
174 ms |
135308 KB |
Output is correct |
13 |
Correct |
150 ms |
96060 KB |
Output is correct |
14 |
Correct |
218 ms |
172252 KB |
Output is correct |
15 |
Correct |
216 ms |
172248 KB |
Output is correct |
16 |
Correct |
2 ms |
12632 KB |
Output is correct |
17 |
Correct |
1 ms |
12636 KB |
Output is correct |
18 |
Correct |
1 ms |
10588 KB |
Output is correct |
19 |
Correct |
1 ms |
8796 KB |
Output is correct |
20 |
Correct |
1 ms |
6492 KB |
Output is correct |
21 |
Correct |
1 ms |
12636 KB |
Output is correct |
22 |
Correct |
1 ms |
12752 KB |
Output is correct |
23 |
Correct |
2 ms |
12636 KB |
Output is correct |
24 |
Correct |
2 ms |
12780 KB |
Output is correct |
25 |
Correct |
1 ms |
10584 KB |
Output is correct |