답안 #659274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659274 2022-11-17T08:47:48 Z mychecksedad Amusement Park (CEOI19_amusementpark) C++17
19 / 100
173 ms 21500 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 += (1 << 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;
      |                ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 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 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 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 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 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 1 ms 212 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 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 576 KB Output is correct
32 Correct 5 ms 320 KB Output is correct
33 Correct 7 ms 244 KB Output is correct
34 Correct 10 ms 380 KB Output is correct
35 Correct 11 ms 448 KB Output is correct
36 Correct 13 ms 960 KB Output is correct
37 Correct 19 ms 1748 KB Output is correct
38 Correct 17 ms 2772 KB Output is correct
39 Correct 39 ms 304 KB Output is correct
40 Correct 60 ms 328 KB Output is correct
41 Correct 77 ms 388 KB Output is correct
42 Correct 86 ms 584 KB Output is correct
43 Correct 100 ms 2076 KB Output is correct
44 Correct 109 ms 3584 KB Output is correct
45 Correct 123 ms 7672 KB Output is correct
46 Correct 148 ms 14488 KB Output is correct
47 Incorrect 173 ms 21500 KB Output isn't correct
48 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 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 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 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 1 ms 212 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 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 576 KB Output is correct
32 Correct 5 ms 320 KB Output is correct
33 Correct 7 ms 244 KB Output is correct
34 Correct 10 ms 380 KB Output is correct
35 Correct 11 ms 448 KB Output is correct
36 Correct 13 ms 960 KB Output is correct
37 Correct 19 ms 1748 KB Output is correct
38 Correct 17 ms 2772 KB Output is correct
39 Correct 39 ms 304 KB Output is correct
40 Correct 60 ms 328 KB Output is correct
41 Correct 77 ms 388 KB Output is correct
42 Correct 86 ms 584 KB Output is correct
43 Correct 100 ms 2076 KB Output is correct
44 Correct 109 ms 3584 KB Output is correct
45 Correct 123 ms 7672 KB Output is correct
46 Correct 148 ms 14488 KB Output is correct
47 Incorrect 173 ms 21500 KB Output isn't correct
48 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 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 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 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 1 ms 212 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 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 576 KB Output is correct
32 Correct 5 ms 320 KB Output is correct
33 Correct 7 ms 244 KB Output is correct
34 Correct 10 ms 380 KB Output is correct
35 Correct 11 ms 448 KB Output is correct
36 Correct 13 ms 960 KB Output is correct
37 Correct 19 ms 1748 KB Output is correct
38 Correct 17 ms 2772 KB Output is correct
39 Correct 39 ms 304 KB Output is correct
40 Correct 60 ms 328 KB Output is correct
41 Correct 77 ms 388 KB Output is correct
42 Correct 86 ms 584 KB Output is correct
43 Correct 100 ms 2076 KB Output is correct
44 Correct 109 ms 3584 KB Output is correct
45 Correct 123 ms 7672 KB Output is correct
46 Correct 148 ms 14488 KB Output is correct
47 Incorrect 173 ms 21500 KB Output isn't correct
48 Halted 0 ms 0 KB -