# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
985976 | 2024-05-19T13:21:45 Z | duckindog | Amusement Park (CEOI19_amusementpark) | C++17 | 3000 ms | 162176 KB |
#include <bits/stdc++.h> using namespace std; const int N = 18 + 10, M = 998'244'353; int n, m; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m; vector<int> a(m + 1), b(m + 1); for (int i = 1; i <= m; ++i) cin >> a[i] >> b[i]; long long answer = 0; vector<int> vt(n); iota(vt.begin(), vt.end(), 1); unordered_map<long long, bool> mk; do { vector<int> p(n + 1); for (int i = 0; i < n; ++i) p[vt[i]] = i; long long mask = 0, cnt = 0; for (int i = 1; i <= m; ++i) if (p[a[i]] > p[b[i]]) mask |= (1ll << i - 1); if (!mk[mask]) { answer += __builtin_popcountll(mask); mk[mask] = true; } } while (next_permutation(vt.begin(), vt.end())); cout << answer % M << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 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 | 0 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 | 500 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 | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 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 | 0 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 | 500 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 | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 388 KB | Output is correct |
27 | Correct | 1 ms | 344 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 | 348 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 2 ms | 348 KB | Output is correct |
33 | Correct | 2 ms | 348 KB | Output is correct |
34 | Correct | 3 ms | 384 KB | Output is correct |
35 | Correct | 4 ms | 604 KB | Output is correct |
36 | Correct | 5 ms | 964 KB | Output is correct |
37 | Correct | 7 ms | 1464 KB | Output is correct |
38 | Correct | 9 ms | 1976 KB | Output is correct |
39 | Correct | 12 ms | 348 KB | Output is correct |
40 | Correct | 17 ms | 464 KB | Output is correct |
41 | Correct | 21 ms | 512 KB | Output is correct |
42 | Correct | 24 ms | 604 KB | Output is correct |
43 | Correct | 32 ms | 1464 KB | Output is correct |
44 | Correct | 40 ms | 2640 KB | Output is correct |
45 | Correct | 54 ms | 5316 KB | Output is correct |
46 | Correct | 72 ms | 10108 KB | Output is correct |
47 | Correct | 133 ms | 19836 KB | Output is correct |
48 | Correct | 16 ms | 348 KB | Output is correct |
49 | Correct | 23 ms | 604 KB | Output is correct |
50 | Correct | 22 ms | 604 KB | Output is correct |
51 | Correct | 21 ms | 604 KB | Output is correct |
52 | Correct | 124 ms | 348 KB | Output is correct |
53 | Correct | 161 ms | 464 KB | Output is correct |
54 | Correct | 205 ms | 716 KB | Output is correct |
55 | Correct | 249 ms | 1704 KB | Output is correct |
56 | Correct | 337 ms | 9824 KB | Output is correct |
57 | Correct | 460 ms | 20724 KB | Output is correct |
58 | Correct | 829 ms | 43972 KB | Output is correct |
59 | Correct | 1354 ms | 86408 KB | Output is correct |
60 | Correct | 2299 ms | 162176 KB | Output is correct |
61 | Correct | 161 ms | 348 KB | Output is correct |
62 | Correct | 223 ms | 1012 KB | Output is correct |
63 | Correct | 205 ms | 856 KB | Output is correct |
64 | Correct | 213 ms | 848 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 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 | 0 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 | 500 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 | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 388 KB | Output is correct |
27 | Correct | 1 ms | 344 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 | 348 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 2 ms | 348 KB | Output is correct |
33 | Correct | 2 ms | 348 KB | Output is correct |
34 | Correct | 3 ms | 384 KB | Output is correct |
35 | Correct | 4 ms | 604 KB | Output is correct |
36 | Correct | 5 ms | 964 KB | Output is correct |
37 | Correct | 7 ms | 1464 KB | Output is correct |
38 | Correct | 9 ms | 1976 KB | Output is correct |
39 | Correct | 12 ms | 348 KB | Output is correct |
40 | Correct | 17 ms | 464 KB | Output is correct |
41 | Correct | 21 ms | 512 KB | Output is correct |
42 | Correct | 24 ms | 604 KB | Output is correct |
43 | Correct | 32 ms | 1464 KB | Output is correct |
44 | Correct | 40 ms | 2640 KB | Output is correct |
45 | Correct | 54 ms | 5316 KB | Output is correct |
46 | Correct | 72 ms | 10108 KB | Output is correct |
47 | Correct | 133 ms | 19836 KB | Output is correct |
48 | Correct | 16 ms | 348 KB | Output is correct |
49 | Correct | 23 ms | 604 KB | Output is correct |
50 | Correct | 22 ms | 604 KB | Output is correct |
51 | Correct | 21 ms | 604 KB | Output is correct |
52 | Correct | 124 ms | 348 KB | Output is correct |
53 | Correct | 161 ms | 464 KB | Output is correct |
54 | Correct | 205 ms | 716 KB | Output is correct |
55 | Correct | 249 ms | 1704 KB | Output is correct |
56 | Correct | 337 ms | 9824 KB | Output is correct |
57 | Correct | 460 ms | 20724 KB | Output is correct |
58 | Correct | 829 ms | 43972 KB | Output is correct |
59 | Correct | 1354 ms | 86408 KB | Output is correct |
60 | Correct | 2299 ms | 162176 KB | Output is correct |
61 | Correct | 161 ms | 348 KB | Output is correct |
62 | Correct | 223 ms | 1012 KB | Output is correct |
63 | Correct | 205 ms | 856 KB | Output is correct |
64 | Correct | 213 ms | 848 KB | Output is correct |
65 | Execution timed out | 3058 ms | 10220 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 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 | 0 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 | 500 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 | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 388 KB | Output is correct |
27 | Correct | 1 ms | 344 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 | 348 KB | Output is correct |
31 | Correct | 1 ms | 604 KB | Output is correct |
32 | Correct | 2 ms | 348 KB | Output is correct |
33 | Correct | 2 ms | 348 KB | Output is correct |
34 | Correct | 3 ms | 384 KB | Output is correct |
35 | Correct | 4 ms | 604 KB | Output is correct |
36 | Correct | 5 ms | 964 KB | Output is correct |
37 | Correct | 7 ms | 1464 KB | Output is correct |
38 | Correct | 9 ms | 1976 KB | Output is correct |
39 | Correct | 12 ms | 348 KB | Output is correct |
40 | Correct | 17 ms | 464 KB | Output is correct |
41 | Correct | 21 ms | 512 KB | Output is correct |
42 | Correct | 24 ms | 604 KB | Output is correct |
43 | Correct | 32 ms | 1464 KB | Output is correct |
44 | Correct | 40 ms | 2640 KB | Output is correct |
45 | Correct | 54 ms | 5316 KB | Output is correct |
46 | Correct | 72 ms | 10108 KB | Output is correct |
47 | Correct | 133 ms | 19836 KB | Output is correct |
48 | Correct | 16 ms | 348 KB | Output is correct |
49 | Correct | 23 ms | 604 KB | Output is correct |
50 | Correct | 22 ms | 604 KB | Output is correct |
51 | Correct | 21 ms | 604 KB | Output is correct |
52 | Correct | 124 ms | 348 KB | Output is correct |
53 | Correct | 161 ms | 464 KB | Output is correct |
54 | Correct | 205 ms | 716 KB | Output is correct |
55 | Correct | 249 ms | 1704 KB | Output is correct |
56 | Correct | 337 ms | 9824 KB | Output is correct |
57 | Correct | 460 ms | 20724 KB | Output is correct |
58 | Correct | 829 ms | 43972 KB | Output is correct |
59 | Correct | 1354 ms | 86408 KB | Output is correct |
60 | Correct | 2299 ms | 162176 KB | Output is correct |
61 | Correct | 161 ms | 348 KB | Output is correct |
62 | Correct | 223 ms | 1012 KB | Output is correct |
63 | Correct | 205 ms | 856 KB | Output is correct |
64 | Correct | 213 ms | 848 KB | Output is correct |
65 | Execution timed out | 3058 ms | 10220 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |