Submission #1095263

# Submission time Handle Problem Language Result Execution time Memory
1095263 2024-10-01T16:54:57 Z mar Amusement Park (CEOI19_amusementpark) C++14
42 / 100
3000 ms 170664 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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>>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;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 344 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 1 ms 348 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 344 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 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 1 ms 600 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 344 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 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 1 ms 600 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 444 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 4 ms 548 KB Output is correct
36 Correct 6 ms 856 KB Output is correct
37 Correct 9 ms 1368 KB Output is correct
38 Correct 12 ms 2136 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 8 ms 348 KB Output is correct
41 Correct 14 ms 344 KB Output is correct
42 Correct 19 ms 600 KB Output is correct
43 Correct 37 ms 1532 KB Output is correct
44 Correct 53 ms 2900 KB Output is correct
45 Correct 75 ms 5884 KB Output is correct
46 Correct 105 ms 10836 KB Output is correct
47 Correct 130 ms 17456 KB Output is correct
48 Correct 7 ms 344 KB Output is correct
49 Correct 13 ms 600 KB Output is correct
50 Correct 14 ms 604 KB Output is correct
51 Correct 16 ms 604 KB Output is correct
52 Correct 47 ms 344 KB Output is correct
53 Correct 82 ms 456 KB Output is correct
54 Correct 170 ms 592 KB Output is correct
55 Correct 307 ms 1876 KB Output is correct
56 Correct 356 ms 8820 KB Output is correct
57 Correct 602 ms 22772 KB Output is correct
58 Correct 912 ms 48364 KB Output is correct
59 Correct 1220 ms 94804 KB Output is correct
60 Correct 2193 ms 170664 KB Output is correct
61 Correct 75 ms 344 KB Output is correct
62 Correct 143 ms 844 KB Output is correct
63 Correct 157 ms 892 KB Output is correct
64 Correct 184 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 344 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 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 1 ms 600 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 444 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 4 ms 548 KB Output is correct
36 Correct 6 ms 856 KB Output is correct
37 Correct 9 ms 1368 KB Output is correct
38 Correct 12 ms 2136 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 8 ms 348 KB Output is correct
41 Correct 14 ms 344 KB Output is correct
42 Correct 19 ms 600 KB Output is correct
43 Correct 37 ms 1532 KB Output is correct
44 Correct 53 ms 2900 KB Output is correct
45 Correct 75 ms 5884 KB Output is correct
46 Correct 105 ms 10836 KB Output is correct
47 Correct 130 ms 17456 KB Output is correct
48 Correct 7 ms 344 KB Output is correct
49 Correct 13 ms 600 KB Output is correct
50 Correct 14 ms 604 KB Output is correct
51 Correct 16 ms 604 KB Output is correct
52 Correct 47 ms 344 KB Output is correct
53 Correct 82 ms 456 KB Output is correct
54 Correct 170 ms 592 KB Output is correct
55 Correct 307 ms 1876 KB Output is correct
56 Correct 356 ms 8820 KB Output is correct
57 Correct 602 ms 22772 KB Output is correct
58 Correct 912 ms 48364 KB Output is correct
59 Correct 1220 ms 94804 KB Output is correct
60 Correct 2193 ms 170664 KB Output is correct
61 Correct 75 ms 344 KB Output is correct
62 Correct 143 ms 844 KB Output is correct
63 Correct 157 ms 892 KB Output is correct
64 Correct 184 ms 848 KB Output is correct
65 Execution timed out 3072 ms 7632 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 344 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 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 1 ms 600 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 444 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 3 ms 348 KB Output is correct
35 Correct 4 ms 548 KB Output is correct
36 Correct 6 ms 856 KB Output is correct
37 Correct 9 ms 1368 KB Output is correct
38 Correct 12 ms 2136 KB Output is correct
39 Correct 5 ms 348 KB Output is correct
40 Correct 8 ms 348 KB Output is correct
41 Correct 14 ms 344 KB Output is correct
42 Correct 19 ms 600 KB Output is correct
43 Correct 37 ms 1532 KB Output is correct
44 Correct 53 ms 2900 KB Output is correct
45 Correct 75 ms 5884 KB Output is correct
46 Correct 105 ms 10836 KB Output is correct
47 Correct 130 ms 17456 KB Output is correct
48 Correct 7 ms 344 KB Output is correct
49 Correct 13 ms 600 KB Output is correct
50 Correct 14 ms 604 KB Output is correct
51 Correct 16 ms 604 KB Output is correct
52 Correct 47 ms 344 KB Output is correct
53 Correct 82 ms 456 KB Output is correct
54 Correct 170 ms 592 KB Output is correct
55 Correct 307 ms 1876 KB Output is correct
56 Correct 356 ms 8820 KB Output is correct
57 Correct 602 ms 22772 KB Output is correct
58 Correct 912 ms 48364 KB Output is correct
59 Correct 1220 ms 94804 KB Output is correct
60 Correct 2193 ms 170664 KB Output is correct
61 Correct 75 ms 344 KB Output is correct
62 Correct 143 ms 844 KB Output is correct
63 Correct 157 ms 892 KB Output is correct
64 Correct 184 ms 848 KB Output is correct
65 Execution timed out 3072 ms 7632 KB Time limit exceeded
66 Halted 0 ms 0 KB -