# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208148 | 2020-03-10T06:03:45 Z | E869120 | Amusement Park (CEOI19_amusementpark) | C++14 | 3000 ms | 263304 KB |
#include <iostream> #include <algorithm> #include <vector> using namespace std; #pragma warning (disable: 4996) long long mod = 998244353; int N, M, A[1009], B[1009]; int idx[11]; int main() { cin >> N >> M; for (int i = 1; i <= M; i++) cin >> A[i] >> B[i]; for (int i = 1; i <= N; i++) idx[i] = i; vector<long long> vec; do { long long ret = 0; for (int i = 1; i <= M; i++) { if (idx[A[i]] < idx[B[i]]) ret += (1LL << (i - 1)); } vec.push_back(ret); } while (next_permutation(idx + 1, idx + N + 1)); sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end()); long long ans = 1LL * M * vec.size() % mod; if (ans % 2LL == 1LL) ans += mod; ans /= 2LL; cout << ans << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 300 KB | Output is correct |
25 | Correct | 5 ms | 508 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 504 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 7 ms | 1012 KB | Output is correct |
33 | Correct | 8 ms | 1012 KB | Output is correct |
34 | Correct | 9 ms | 1012 KB | Output is correct |
35 | Correct | 10 ms | 1012 KB | Output is correct |
36 | Correct | 11 ms | 1012 KB | Output is correct |
37 | Correct | 13 ms | 1012 KB | Output is correct |
38 | Correct | 13 ms | 1012 KB | Output is correct |
39 | Correct | 19 ms | 4580 KB | Output is correct |
40 | Correct | 32 ms | 4580 KB | Output is correct |
41 | Correct | 41 ms | 4580 KB | Output is correct |
42 | Correct | 51 ms | 4580 KB | Output is correct |
43 | Correct | 64 ms | 4580 KB | Output is correct |
44 | Correct | 74 ms | 4580 KB | Output is correct |
45 | Correct | 85 ms | 4580 KB | Output is correct |
46 | Correct | 95 ms | 4584 KB | Output is correct |
47 | Correct | 103 ms | 4580 KB | Output is correct |
48 | Correct | 40 ms | 4580 KB | Output is correct |
49 | Correct | 39 ms | 4584 KB | Output is correct |
50 | Correct | 44 ms | 4580 KB | Output is correct |
51 | Correct | 50 ms | 4580 KB | Output is correct |
52 | Correct | 173 ms | 33340 KB | Output is correct |
53 | Correct | 331 ms | 33296 KB | Output is correct |
54 | Correct | 432 ms | 33340 KB | Output is correct |
55 | Correct | 605 ms | 33536 KB | Output is correct |
56 | Correct | 680 ms | 33344 KB | Output is correct |
57 | Correct | 834 ms | 33340 KB | Output is correct |
58 | Correct | 1000 ms | 33316 KB | Output is correct |
59 | Correct | 1073 ms | 33316 KB | Output is correct |
60 | Correct | 1179 ms | 33452 KB | Output is correct |
61 | Correct | 250 ms | 33340 KB | Output is correct |
62 | Correct | 370 ms | 33340 KB | Output is correct |
63 | Correct | 440 ms | 33340 KB | Output is correct |
64 | Correct | 494 ms | 33340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 300 KB | Output is correct |
25 | Correct | 5 ms | 508 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 504 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 7 ms | 1012 KB | Output is correct |
33 | Correct | 8 ms | 1012 KB | Output is correct |
34 | Correct | 9 ms | 1012 KB | Output is correct |
35 | Correct | 10 ms | 1012 KB | Output is correct |
36 | Correct | 11 ms | 1012 KB | Output is correct |
37 | Correct | 13 ms | 1012 KB | Output is correct |
38 | Correct | 13 ms | 1012 KB | Output is correct |
39 | Correct | 19 ms | 4580 KB | Output is correct |
40 | Correct | 32 ms | 4580 KB | Output is correct |
41 | Correct | 41 ms | 4580 KB | Output is correct |
42 | Correct | 51 ms | 4580 KB | Output is correct |
43 | Correct | 64 ms | 4580 KB | Output is correct |
44 | Correct | 74 ms | 4580 KB | Output is correct |
45 | Correct | 85 ms | 4580 KB | Output is correct |
46 | Correct | 95 ms | 4584 KB | Output is correct |
47 | Correct | 103 ms | 4580 KB | Output is correct |
48 | Correct | 40 ms | 4580 KB | Output is correct |
49 | Correct | 39 ms | 4584 KB | Output is correct |
50 | Correct | 44 ms | 4580 KB | Output is correct |
51 | Correct | 50 ms | 4580 KB | Output is correct |
52 | Correct | 173 ms | 33340 KB | Output is correct |
53 | Correct | 331 ms | 33296 KB | Output is correct |
54 | Correct | 432 ms | 33340 KB | Output is correct |
55 | Correct | 605 ms | 33536 KB | Output is correct |
56 | Correct | 680 ms | 33344 KB | Output is correct |
57 | Correct | 834 ms | 33340 KB | Output is correct |
58 | Correct | 1000 ms | 33316 KB | Output is correct |
59 | Correct | 1073 ms | 33316 KB | Output is correct |
60 | Correct | 1179 ms | 33452 KB | Output is correct |
61 | Correct | 250 ms | 33340 KB | Output is correct |
62 | Correct | 370 ms | 33340 KB | Output is correct |
63 | Correct | 440 ms | 33340 KB | Output is correct |
64 | Correct | 494 ms | 33340 KB | Output is correct |
65 | Execution timed out | 3083 ms | 263304 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 380 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 504 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 5 ms | 376 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 5 ms | 300 KB | Output is correct |
25 | Correct | 5 ms | 508 KB | Output is correct |
26 | Correct | 5 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 5 ms | 504 KB | Output is correct |
29 | Correct | 5 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 5 ms | 376 KB | Output is correct |
32 | Correct | 7 ms | 1012 KB | Output is correct |
33 | Correct | 8 ms | 1012 KB | Output is correct |
34 | Correct | 9 ms | 1012 KB | Output is correct |
35 | Correct | 10 ms | 1012 KB | Output is correct |
36 | Correct | 11 ms | 1012 KB | Output is correct |
37 | Correct | 13 ms | 1012 KB | Output is correct |
38 | Correct | 13 ms | 1012 KB | Output is correct |
39 | Correct | 19 ms | 4580 KB | Output is correct |
40 | Correct | 32 ms | 4580 KB | Output is correct |
41 | Correct | 41 ms | 4580 KB | Output is correct |
42 | Correct | 51 ms | 4580 KB | Output is correct |
43 | Correct | 64 ms | 4580 KB | Output is correct |
44 | Correct | 74 ms | 4580 KB | Output is correct |
45 | Correct | 85 ms | 4580 KB | Output is correct |
46 | Correct | 95 ms | 4584 KB | Output is correct |
47 | Correct | 103 ms | 4580 KB | Output is correct |
48 | Correct | 40 ms | 4580 KB | Output is correct |
49 | Correct | 39 ms | 4584 KB | Output is correct |
50 | Correct | 44 ms | 4580 KB | Output is correct |
51 | Correct | 50 ms | 4580 KB | Output is correct |
52 | Correct | 173 ms | 33340 KB | Output is correct |
53 | Correct | 331 ms | 33296 KB | Output is correct |
54 | Correct | 432 ms | 33340 KB | Output is correct |
55 | Correct | 605 ms | 33536 KB | Output is correct |
56 | Correct | 680 ms | 33344 KB | Output is correct |
57 | Correct | 834 ms | 33340 KB | Output is correct |
58 | Correct | 1000 ms | 33316 KB | Output is correct |
59 | Correct | 1073 ms | 33316 KB | Output is correct |
60 | Correct | 1179 ms | 33452 KB | Output is correct |
61 | Correct | 250 ms | 33340 KB | Output is correct |
62 | Correct | 370 ms | 33340 KB | Output is correct |
63 | Correct | 440 ms | 33340 KB | Output is correct |
64 | Correct | 494 ms | 33340 KB | Output is correct |
65 | Execution timed out | 3083 ms | 263304 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |