Submission #659275

# Submission time Handle Problem Language Result Execution time Memory
659275 2022-11-17T08:49:34 Z mychecksedad Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 227596 KB
/* Author : Mychecksdead */
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD1 (1000000000+7)
#define MOD (998244353)
#define PI 3.1415926535
#define pb push_back
#define setp() cout << setprecision(15)
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " is " << x << '\n';
const int N = 1e6+100, M = 1e5+10, F = 2147483646, K = 20;


int n, m;
ll e[20][20];

void solve(){
    cin >> n >> m;
    for(int i = 1; i <= n; ++i) for(int j = 1; j <= n; ++j) e[i][j] = -1;
    for(int i = 1; i <= m; ++i){
        int u, v; cin >> u >> v;
        e[u][v] = i - 1;
    }
    vector<int> a;
    for(int i=1; i<=n; ++i) a.pb(i);
    ll ans = 0;
    map<ll, bool> taken;
    do{ 
        ll c = 0, h = 0;
        for(int i = 1; i < n; ++i){
            for(int j = 0; j < i; ++j){
                int u = a[j], v = a[i];
                if(e[u][v] == -1 && e[v][u] > -1){
                    c++;
                    h += (1ll << e[v][u]);
                } 
            }
        }
        if(!taken[h]) taken[h] = 1, (ans += c) %= MOD;
    }while(next_permutation(a.begin(), a.end()));
    cout << ans;
}





int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    int T = 1, aa;
    // cin >> T;aa=T;
    while(T--){
        // cout << "Case #" << aa-T << ": ";
        solve();
        cout << '\n';
    }
    return 0;
 
}

Compilation message

amusementpark.cpp: In function 'int main()':
amusementpark.cpp:54:16: warning: unused variable 'aa' [-Wunused-variable]
   54 |     int T = 1, aa;
      |                ^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 320 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 596 KB Output is correct
32 Correct 5 ms 340 KB Output is correct
33 Correct 7 ms 212 KB Output is correct
34 Correct 9 ms 340 KB Output is correct
35 Correct 11 ms 468 KB Output is correct
36 Correct 13 ms 944 KB Output is correct
37 Correct 16 ms 1728 KB Output is correct
38 Correct 17 ms 2820 KB Output is correct
39 Correct 40 ms 316 KB Output is correct
40 Correct 60 ms 212 KB Output is correct
41 Correct 87 ms 384 KB Output is correct
42 Correct 105 ms 632 KB Output is correct
43 Correct 110 ms 1996 KB Output is correct
44 Correct 114 ms 3572 KB Output is correct
45 Correct 129 ms 7644 KB Output is correct
46 Correct 169 ms 14332 KB Output is correct
47 Correct 201 ms 23020 KB Output is correct
48 Correct 34 ms 336 KB Output is correct
49 Correct 61 ms 528 KB Output is correct
50 Correct 69 ms 488 KB Output is correct
51 Correct 47 ms 572 KB Output is correct
52 Correct 472 ms 304 KB Output is correct
53 Correct 660 ms 352 KB Output is correct
54 Correct 920 ms 640 KB Output is correct
55 Correct 992 ms 2312 KB Output is correct
56 Correct 1209 ms 11636 KB Output is correct
57 Correct 1270 ms 30164 KB Output is correct
58 Correct 1421 ms 64516 KB Output is correct
59 Correct 1662 ms 126132 KB Output is correct
60 Correct 2057 ms 227596 KB Output is correct
61 Correct 374 ms 460 KB Output is correct
62 Correct 536 ms 1096 KB Output is correct
63 Correct 469 ms 1100 KB Output is correct
64 Correct 595 ms 1176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 320 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 596 KB Output is correct
32 Correct 5 ms 340 KB Output is correct
33 Correct 7 ms 212 KB Output is correct
34 Correct 9 ms 340 KB Output is correct
35 Correct 11 ms 468 KB Output is correct
36 Correct 13 ms 944 KB Output is correct
37 Correct 16 ms 1728 KB Output is correct
38 Correct 17 ms 2820 KB Output is correct
39 Correct 40 ms 316 KB Output is correct
40 Correct 60 ms 212 KB Output is correct
41 Correct 87 ms 384 KB Output is correct
42 Correct 105 ms 632 KB Output is correct
43 Correct 110 ms 1996 KB Output is correct
44 Correct 114 ms 3572 KB Output is correct
45 Correct 129 ms 7644 KB Output is correct
46 Correct 169 ms 14332 KB Output is correct
47 Correct 201 ms 23020 KB Output is correct
48 Correct 34 ms 336 KB Output is correct
49 Correct 61 ms 528 KB Output is correct
50 Correct 69 ms 488 KB Output is correct
51 Correct 47 ms 572 KB Output is correct
52 Correct 472 ms 304 KB Output is correct
53 Correct 660 ms 352 KB Output is correct
54 Correct 920 ms 640 KB Output is correct
55 Correct 992 ms 2312 KB Output is correct
56 Correct 1209 ms 11636 KB Output is correct
57 Correct 1270 ms 30164 KB Output is correct
58 Correct 1421 ms 64516 KB Output is correct
59 Correct 1662 ms 126132 KB Output is correct
60 Correct 2057 ms 227596 KB Output is correct
61 Correct 374 ms 460 KB Output is correct
62 Correct 536 ms 1096 KB Output is correct
63 Correct 469 ms 1100 KB Output is correct
64 Correct 595 ms 1176 KB Output is correct
65 Execution timed out 3064 ms 6172 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 260 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 320 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 468 KB Output is correct
31 Correct 2 ms 596 KB Output is correct
32 Correct 5 ms 340 KB Output is correct
33 Correct 7 ms 212 KB Output is correct
34 Correct 9 ms 340 KB Output is correct
35 Correct 11 ms 468 KB Output is correct
36 Correct 13 ms 944 KB Output is correct
37 Correct 16 ms 1728 KB Output is correct
38 Correct 17 ms 2820 KB Output is correct
39 Correct 40 ms 316 KB Output is correct
40 Correct 60 ms 212 KB Output is correct
41 Correct 87 ms 384 KB Output is correct
42 Correct 105 ms 632 KB Output is correct
43 Correct 110 ms 1996 KB Output is correct
44 Correct 114 ms 3572 KB Output is correct
45 Correct 129 ms 7644 KB Output is correct
46 Correct 169 ms 14332 KB Output is correct
47 Correct 201 ms 23020 KB Output is correct
48 Correct 34 ms 336 KB Output is correct
49 Correct 61 ms 528 KB Output is correct
50 Correct 69 ms 488 KB Output is correct
51 Correct 47 ms 572 KB Output is correct
52 Correct 472 ms 304 KB Output is correct
53 Correct 660 ms 352 KB Output is correct
54 Correct 920 ms 640 KB Output is correct
55 Correct 992 ms 2312 KB Output is correct
56 Correct 1209 ms 11636 KB Output is correct
57 Correct 1270 ms 30164 KB Output is correct
58 Correct 1421 ms 64516 KB Output is correct
59 Correct 1662 ms 126132 KB Output is correct
60 Correct 2057 ms 227596 KB Output is correct
61 Correct 374 ms 460 KB Output is correct
62 Correct 536 ms 1096 KB Output is correct
63 Correct 469 ms 1100 KB Output is correct
64 Correct 595 ms 1176 KB Output is correct
65 Execution timed out 3064 ms 6172 KB Time limit exceeded
66 Halted 0 ms 0 KB -