Submission #1062554

# Submission time Handle Problem Language Result Execution time Memory
1062554 2024-08-17T08:31:00 Z thinknoexit Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 227476 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;
int a[155], b[155], p[22];
map<ll, bool> ch;
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    set<int> s;
    for (int i = 0;i < m;i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 1;i <= n;i++) p[i] = i;
    int ans = 0;
    do {
        int now = 0;
        ll bit = 0;
        for (int i = 0;i < m;i++) {
            if (p[a[i]] > p[b[i]]) {
                now++;
                bit ^= (1ll << i);
            }
        }
        if (!ch.count(bit)) {
            ch[bit] = 1;
            ans = (ans + now) % MOD;
        }
    } while (next_permutation(p + 1, p + 1 + n));
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 632 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 6 ms 1092 KB Output is correct
37 Correct 9 ms 1896 KB Output is correct
38 Correct 13 ms 2908 KB Output is correct
39 Correct 4 ms 456 KB Output is correct
40 Correct 6 ms 468 KB Output is correct
41 Correct 12 ms 536 KB Output is correct
42 Correct 17 ms 700 KB Output is correct
43 Correct 35 ms 2168 KB Output is correct
44 Correct 48 ms 3708 KB Output is correct
45 Correct 74 ms 7760 KB Output is correct
46 Correct 107 ms 14424 KB Output is correct
47 Correct 150 ms 23008 KB Output is correct
48 Correct 5 ms 348 KB Output is correct
49 Correct 11 ms 604 KB Output is correct
50 Correct 13 ms 644 KB Output is correct
51 Correct 16 ms 600 KB Output is correct
52 Correct 53 ms 348 KB Output is correct
53 Correct 65 ms 348 KB Output is correct
54 Correct 132 ms 604 KB Output is correct
55 Correct 304 ms 2304 KB Output is correct
56 Correct 333 ms 11580 KB Output is correct
57 Correct 593 ms 30216 KB Output is correct
58 Correct 959 ms 64448 KB Output is correct
59 Correct 1283 ms 126428 KB Output is correct
60 Correct 1986 ms 227476 KB Output is correct
61 Correct 64 ms 344 KB Output is correct
62 Correct 102 ms 1216 KB Output is correct
63 Correct 134 ms 1084 KB Output is correct
64 Correct 162 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 632 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 6 ms 1092 KB Output is correct
37 Correct 9 ms 1896 KB Output is correct
38 Correct 13 ms 2908 KB Output is correct
39 Correct 4 ms 456 KB Output is correct
40 Correct 6 ms 468 KB Output is correct
41 Correct 12 ms 536 KB Output is correct
42 Correct 17 ms 700 KB Output is correct
43 Correct 35 ms 2168 KB Output is correct
44 Correct 48 ms 3708 KB Output is correct
45 Correct 74 ms 7760 KB Output is correct
46 Correct 107 ms 14424 KB Output is correct
47 Correct 150 ms 23008 KB Output is correct
48 Correct 5 ms 348 KB Output is correct
49 Correct 11 ms 604 KB Output is correct
50 Correct 13 ms 644 KB Output is correct
51 Correct 16 ms 600 KB Output is correct
52 Correct 53 ms 348 KB Output is correct
53 Correct 65 ms 348 KB Output is correct
54 Correct 132 ms 604 KB Output is correct
55 Correct 304 ms 2304 KB Output is correct
56 Correct 333 ms 11580 KB Output is correct
57 Correct 593 ms 30216 KB Output is correct
58 Correct 959 ms 64448 KB Output is correct
59 Correct 1283 ms 126428 KB Output is correct
60 Correct 1986 ms 227476 KB Output is correct
61 Correct 64 ms 344 KB Output is correct
62 Correct 102 ms 1216 KB Output is correct
63 Correct 134 ms 1084 KB Output is correct
64 Correct 162 ms 1104 KB Output is correct
65 Execution timed out 3053 ms 10912 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 632 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 6 ms 1092 KB Output is correct
37 Correct 9 ms 1896 KB Output is correct
38 Correct 13 ms 2908 KB Output is correct
39 Correct 4 ms 456 KB Output is correct
40 Correct 6 ms 468 KB Output is correct
41 Correct 12 ms 536 KB Output is correct
42 Correct 17 ms 700 KB Output is correct
43 Correct 35 ms 2168 KB Output is correct
44 Correct 48 ms 3708 KB Output is correct
45 Correct 74 ms 7760 KB Output is correct
46 Correct 107 ms 14424 KB Output is correct
47 Correct 150 ms 23008 KB Output is correct
48 Correct 5 ms 348 KB Output is correct
49 Correct 11 ms 604 KB Output is correct
50 Correct 13 ms 644 KB Output is correct
51 Correct 16 ms 600 KB Output is correct
52 Correct 53 ms 348 KB Output is correct
53 Correct 65 ms 348 KB Output is correct
54 Correct 132 ms 604 KB Output is correct
55 Correct 304 ms 2304 KB Output is correct
56 Correct 333 ms 11580 KB Output is correct
57 Correct 593 ms 30216 KB Output is correct
58 Correct 959 ms 64448 KB Output is correct
59 Correct 1283 ms 126428 KB Output is correct
60 Correct 1986 ms 227476 KB Output is correct
61 Correct 64 ms 344 KB Output is correct
62 Correct 102 ms 1216 KB Output is correct
63 Correct 134 ms 1084 KB Output is correct
64 Correct 162 ms 1104 KB Output is correct
65 Execution timed out 3053 ms 10912 KB Time limit exceeded
66 Halted 0 ms 0 KB -