# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
919911 | 2024-02-01T20:33:03 Z | CyberCow | Amusement Park (CEOI19_amusementpark) | C++17 | 3000 ms | 171124 KB |
#include <random> #include <algorithm> #include <bitset> #include <chrono> #include <cmath> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <chrono> #define fr first #define sc second #define ad push_back using namespace std; using ll = long long; mt19937 rnd(348502); const ll N = 20; vector<pair<int,int>> v[N]; int tex[N]; int uxx[N][N]; ll mod = 998244353; void solve() { int n, i, j, m, x, y; cin >> n >> m; for ( i = 0; i < m; i++) { cin >> x >> y; v[x].push_back({ y, i }); v[y].push_back({ x, i }); uxx[x][y] = 1; } vector<int> pereb; for ( i = 1; i <= n; i++) { pereb.push_back(i); } set<ll> ka; ll ans = 0; int bj = 1; do { //cout << bj++ << ' '; for ( i = 0; i < pereb.size(); i++) { tex[pereb[i]] = i; } ll gum = 0, pox = 0; for ( i = 0; i < pereb.size(); i++) { for (auto to : v[pereb[i]]) { if ((tex[pereb[i]] > tex[to.first] && uxx[to.first][pereb[i]] == 0)||(tex[pereb[i]] < tex[to.first] && uxx[pereb[i]][to.first] == 0)) { gum++; pox |= (1LL << to.second); } } } if (ka.find(pox) == ka.end()) { ans = (ans + gum / 2) % mod; ka.insert(pox); } } while (next_permutation(pereb.begin(), pereb.end())); cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll tt = 1; //cin >> tt; while (tt--) { solve(); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 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 | 2 ms | 348 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 2 ms | 604 KB | Output is correct |
32 | Correct | 5 ms | 604 KB | Output is correct |
33 | Correct | 5 ms | 348 KB | Output is correct |
34 | Correct | 7 ms | 348 KB | Output is correct |
35 | Correct | 9 ms | 604 KB | Output is correct |
36 | Correct | 11 ms | 860 KB | Output is correct |
37 | Correct | 14 ms | 1372 KB | Output is correct |
38 | Correct | 17 ms | 2140 KB | Output is correct |
39 | Correct | 29 ms | 500 KB | Output is correct |
40 | Correct | 44 ms | 472 KB | Output is correct |
41 | Correct | 53 ms | 348 KB | Output is correct |
42 | Correct | 60 ms | 656 KB | Output is correct |
43 | Correct | 82 ms | 1620 KB | Output is correct |
44 | Correct | 90 ms | 2724 KB | Output is correct |
45 | Correct | 117 ms | 6096 KB | Output is correct |
46 | Correct | 141 ms | 10836 KB | Output is correct |
47 | Correct | 180 ms | 17372 KB | Output is correct |
48 | Correct | 24 ms | 348 KB | Output is correct |
49 | Correct | 52 ms | 596 KB | Output is correct |
50 | Correct | 51 ms | 612 KB | Output is correct |
51 | Correct | 45 ms | 648 KB | Output is correct |
52 | Correct | 277 ms | 348 KB | Output is correct |
53 | Correct | 435 ms | 712 KB | Output is correct |
54 | Correct | 567 ms | 740 KB | Output is correct |
55 | Correct | 712 ms | 1936 KB | Output is correct |
56 | Correct | 856 ms | 8760 KB | Output is correct |
57 | Correct | 1060 ms | 22840 KB | Output is correct |
58 | Correct | 1294 ms | 48428 KB | Output is correct |
59 | Correct | 1583 ms | 94836 KB | Output is correct |
60 | Correct | 2017 ms | 171124 KB | Output is correct |
61 | Correct | 269 ms | 596 KB | Output is correct |
62 | Correct | 488 ms | 968 KB | Output is correct |
63 | Correct | 452 ms | 964 KB | Output is correct |
64 | Correct | 561 ms | 1092 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 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 | 2 ms | 348 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 2 ms | 604 KB | Output is correct |
32 | Correct | 5 ms | 604 KB | Output is correct |
33 | Correct | 5 ms | 348 KB | Output is correct |
34 | Correct | 7 ms | 348 KB | Output is correct |
35 | Correct | 9 ms | 604 KB | Output is correct |
36 | Correct | 11 ms | 860 KB | Output is correct |
37 | Correct | 14 ms | 1372 KB | Output is correct |
38 | Correct | 17 ms | 2140 KB | Output is correct |
39 | Correct | 29 ms | 500 KB | Output is correct |
40 | Correct | 44 ms | 472 KB | Output is correct |
41 | Correct | 53 ms | 348 KB | Output is correct |
42 | Correct | 60 ms | 656 KB | Output is correct |
43 | Correct | 82 ms | 1620 KB | Output is correct |
44 | Correct | 90 ms | 2724 KB | Output is correct |
45 | Correct | 117 ms | 6096 KB | Output is correct |
46 | Correct | 141 ms | 10836 KB | Output is correct |
47 | Correct | 180 ms | 17372 KB | Output is correct |
48 | Correct | 24 ms | 348 KB | Output is correct |
49 | Correct | 52 ms | 596 KB | Output is correct |
50 | Correct | 51 ms | 612 KB | Output is correct |
51 | Correct | 45 ms | 648 KB | Output is correct |
52 | Correct | 277 ms | 348 KB | Output is correct |
53 | Correct | 435 ms | 712 KB | Output is correct |
54 | Correct | 567 ms | 740 KB | Output is correct |
55 | Correct | 712 ms | 1936 KB | Output is correct |
56 | Correct | 856 ms | 8760 KB | Output is correct |
57 | Correct | 1060 ms | 22840 KB | Output is correct |
58 | Correct | 1294 ms | 48428 KB | Output is correct |
59 | Correct | 1583 ms | 94836 KB | Output is correct |
60 | Correct | 2017 ms | 171124 KB | Output is correct |
61 | Correct | 269 ms | 596 KB | Output is correct |
62 | Correct | 488 ms | 968 KB | Output is correct |
63 | Correct | 452 ms | 964 KB | Output is correct |
64 | Correct | 561 ms | 1092 KB | Output is correct |
65 | Execution timed out | 3026 ms | 5720 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 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 | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 1 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 | 2 ms | 348 KB | Output is correct |
30 | Correct | 2 ms | 604 KB | Output is correct |
31 | Correct | 2 ms | 604 KB | Output is correct |
32 | Correct | 5 ms | 604 KB | Output is correct |
33 | Correct | 5 ms | 348 KB | Output is correct |
34 | Correct | 7 ms | 348 KB | Output is correct |
35 | Correct | 9 ms | 604 KB | Output is correct |
36 | Correct | 11 ms | 860 KB | Output is correct |
37 | Correct | 14 ms | 1372 KB | Output is correct |
38 | Correct | 17 ms | 2140 KB | Output is correct |
39 | Correct | 29 ms | 500 KB | Output is correct |
40 | Correct | 44 ms | 472 KB | Output is correct |
41 | Correct | 53 ms | 348 KB | Output is correct |
42 | Correct | 60 ms | 656 KB | Output is correct |
43 | Correct | 82 ms | 1620 KB | Output is correct |
44 | Correct | 90 ms | 2724 KB | Output is correct |
45 | Correct | 117 ms | 6096 KB | Output is correct |
46 | Correct | 141 ms | 10836 KB | Output is correct |
47 | Correct | 180 ms | 17372 KB | Output is correct |
48 | Correct | 24 ms | 348 KB | Output is correct |
49 | Correct | 52 ms | 596 KB | Output is correct |
50 | Correct | 51 ms | 612 KB | Output is correct |
51 | Correct | 45 ms | 648 KB | Output is correct |
52 | Correct | 277 ms | 348 KB | Output is correct |
53 | Correct | 435 ms | 712 KB | Output is correct |
54 | Correct | 567 ms | 740 KB | Output is correct |
55 | Correct | 712 ms | 1936 KB | Output is correct |
56 | Correct | 856 ms | 8760 KB | Output is correct |
57 | Correct | 1060 ms | 22840 KB | Output is correct |
58 | Correct | 1294 ms | 48428 KB | Output is correct |
59 | Correct | 1583 ms | 94836 KB | Output is correct |
60 | Correct | 2017 ms | 171124 KB | Output is correct |
61 | Correct | 269 ms | 596 KB | Output is correct |
62 | Correct | 488 ms | 968 KB | Output is correct |
63 | Correct | 452 ms | 964 KB | Output is correct |
64 | Correct | 561 ms | 1092 KB | Output is correct |
65 | Execution timed out | 3026 ms | 5720 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |