Submission #1062617

# Submission time Handle Problem Language Result Execution time Memory
1062617 2024-08-17T09:07:25 Z 12345678 Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 170836 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll nx=11, mx=1e3+5, mod=998244353, mod2=1e12+9;

ll n, m, a[mx], b[mx], res, pw[mx];
set<ll> s;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m;
    pw[0]=1;
    for (int i=1; i<=m; i++) pw[i]=(pw[i-1]*2)%mod2;
    for (int i=1; i<=m; i++) cin>>a[i]>>b[i];
    vector<int> v;
    for (int i=1; i<=n; i++) v.push_back(i);
    do
    {
        ll sm=0, cnt=0;
        for (int i=1; i<=m; i++) if (v[a[i]-1]>v[b[i]-1]) cnt++, sm=(sm+pw[i])%mod2;
        if (s.find(sm)==s.end()) res=(res+cnt)%mod, s.insert(sm);
    } while (next_permutation(v.begin(), v.end()));
    cout<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 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 600 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 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 344 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 564 KB Output is correct
31 Correct 1 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 5 ms 860 KB Output is correct
37 Correct 8 ms 1372 KB Output is correct
38 Correct 12 ms 2140 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 7 ms 468 KB Output is correct
41 Correct 14 ms 532 KB Output is correct
42 Correct 24 ms 616 KB Output is correct
43 Correct 38 ms 1616 KB Output is correct
44 Correct 49 ms 2868 KB Output is correct
45 Correct 77 ms 5968 KB Output is correct
46 Correct 112 ms 10836 KB Output is correct
47 Correct 144 ms 17488 KB Output is correct
48 Correct 13 ms 344 KB Output is correct
49 Correct 13 ms 604 KB Output is correct
50 Correct 15 ms 656 KB Output is correct
51 Correct 17 ms 604 KB Output is correct
52 Correct 50 ms 444 KB Output is correct
53 Correct 84 ms 348 KB Output is correct
54 Correct 186 ms 600 KB Output is correct
55 Correct 327 ms 1876 KB Output is correct
56 Correct 407 ms 8956 KB Output is correct
57 Correct 721 ms 22820 KB Output is correct
58 Correct 985 ms 48596 KB Output is correct
59 Correct 1387 ms 94896 KB Output is correct
60 Correct 2312 ms 170836 KB Output is correct
61 Correct 73 ms 348 KB Output is correct
62 Correct 146 ms 848 KB Output is correct
63 Correct 157 ms 876 KB Output is correct
64 Correct 180 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 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 344 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 564 KB Output is correct
31 Correct 1 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 5 ms 860 KB Output is correct
37 Correct 8 ms 1372 KB Output is correct
38 Correct 12 ms 2140 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 7 ms 468 KB Output is correct
41 Correct 14 ms 532 KB Output is correct
42 Correct 24 ms 616 KB Output is correct
43 Correct 38 ms 1616 KB Output is correct
44 Correct 49 ms 2868 KB Output is correct
45 Correct 77 ms 5968 KB Output is correct
46 Correct 112 ms 10836 KB Output is correct
47 Correct 144 ms 17488 KB Output is correct
48 Correct 13 ms 344 KB Output is correct
49 Correct 13 ms 604 KB Output is correct
50 Correct 15 ms 656 KB Output is correct
51 Correct 17 ms 604 KB Output is correct
52 Correct 50 ms 444 KB Output is correct
53 Correct 84 ms 348 KB Output is correct
54 Correct 186 ms 600 KB Output is correct
55 Correct 327 ms 1876 KB Output is correct
56 Correct 407 ms 8956 KB Output is correct
57 Correct 721 ms 22820 KB Output is correct
58 Correct 985 ms 48596 KB Output is correct
59 Correct 1387 ms 94896 KB Output is correct
60 Correct 2312 ms 170836 KB Output is correct
61 Correct 73 ms 348 KB Output is correct
62 Correct 146 ms 848 KB Output is correct
63 Correct 157 ms 876 KB Output is correct
64 Correct 180 ms 848 KB Output is correct
65 Execution timed out 3040 ms 7536 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 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 344 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 564 KB Output is correct
31 Correct 1 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 5 ms 860 KB Output is correct
37 Correct 8 ms 1372 KB Output is correct
38 Correct 12 ms 2140 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 7 ms 468 KB Output is correct
41 Correct 14 ms 532 KB Output is correct
42 Correct 24 ms 616 KB Output is correct
43 Correct 38 ms 1616 KB Output is correct
44 Correct 49 ms 2868 KB Output is correct
45 Correct 77 ms 5968 KB Output is correct
46 Correct 112 ms 10836 KB Output is correct
47 Correct 144 ms 17488 KB Output is correct
48 Correct 13 ms 344 KB Output is correct
49 Correct 13 ms 604 KB Output is correct
50 Correct 15 ms 656 KB Output is correct
51 Correct 17 ms 604 KB Output is correct
52 Correct 50 ms 444 KB Output is correct
53 Correct 84 ms 348 KB Output is correct
54 Correct 186 ms 600 KB Output is correct
55 Correct 327 ms 1876 KB Output is correct
56 Correct 407 ms 8956 KB Output is correct
57 Correct 721 ms 22820 KB Output is correct
58 Correct 985 ms 48596 KB Output is correct
59 Correct 1387 ms 94896 KB Output is correct
60 Correct 2312 ms 170836 KB Output is correct
61 Correct 73 ms 348 KB Output is correct
62 Correct 146 ms 848 KB Output is correct
63 Correct 157 ms 876 KB Output is correct
64 Correct 180 ms 848 KB Output is correct
65 Execution timed out 3040 ms 7536 KB Time limit exceeded
66 Halted 0 ms 0 KB -