답안 #1062615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062615 2024-08-17T09:06:58 Z 12345678 Amusement Park (CEOI19_amusementpark) C++17
19 / 100
106 ms 10836 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=11, mx=1e3+5, mod=998244353, mod2=1e9+7;

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;
}
# 결과 실행 시간 메모리 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 456 KB Output is correct
7 Correct 0 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 456 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 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
# 결과 실행 시간 메모리 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 456 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 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 456 KB Output is correct
27 Correct 0 ms 468 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 464 KB Output is correct
34 Correct 3 ms 524 KB Output is correct
35 Correct 5 ms 456 KB Output is correct
36 Correct 6 ms 712 KB Output is correct
37 Correct 10 ms 1372 KB Output is correct
38 Correct 14 ms 2224 KB Output is correct
39 Correct 6 ms 344 KB Output is correct
40 Correct 7 ms 348 KB Output is correct
41 Correct 19 ms 532 KB Output is correct
42 Correct 21 ms 580 KB Output is correct
43 Correct 46 ms 2032 KB Output is correct
44 Correct 50 ms 2756 KB Output is correct
45 Correct 82 ms 6000 KB Output is correct
46 Incorrect 106 ms 10836 KB Output isn't correct
47 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 456 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 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 456 KB Output is correct
27 Correct 0 ms 468 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 464 KB Output is correct
34 Correct 3 ms 524 KB Output is correct
35 Correct 5 ms 456 KB Output is correct
36 Correct 6 ms 712 KB Output is correct
37 Correct 10 ms 1372 KB Output is correct
38 Correct 14 ms 2224 KB Output is correct
39 Correct 6 ms 344 KB Output is correct
40 Correct 7 ms 348 KB Output is correct
41 Correct 19 ms 532 KB Output is correct
42 Correct 21 ms 580 KB Output is correct
43 Correct 46 ms 2032 KB Output is correct
44 Correct 50 ms 2756 KB Output is correct
45 Correct 82 ms 6000 KB Output is correct
46 Incorrect 106 ms 10836 KB Output isn't correct
47 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 456 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 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 456 KB Output is correct
27 Correct 0 ms 468 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 2 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 464 KB Output is correct
34 Correct 3 ms 524 KB Output is correct
35 Correct 5 ms 456 KB Output is correct
36 Correct 6 ms 712 KB Output is correct
37 Correct 10 ms 1372 KB Output is correct
38 Correct 14 ms 2224 KB Output is correct
39 Correct 6 ms 344 KB Output is correct
40 Correct 7 ms 348 KB Output is correct
41 Correct 19 ms 532 KB Output is correct
42 Correct 21 ms 580 KB Output is correct
43 Correct 46 ms 2032 KB Output is correct
44 Correct 50 ms 2756 KB Output is correct
45 Correct 82 ms 6000 KB Output is correct
46 Incorrect 106 ms 10836 KB Output isn't correct
47 Halted 0 ms 0 KB -