# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
203803 | 2020-02-22T08:04:26 Z | dndhk | Amusement Park (CEOI19_amusementpark) | C++14 | 3000 ms | 66072 KB |
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef pair<int, int> pii; typedef long long ll; const int MAX_N = 30; const ll MOD = 998244353; int N, M; vector<int> gp[MAX_N+1]; vector<pii> edge; int c[MAX_N+1], idx[MAX_N+1]; ll ans; vector<ll> vt; set<ll> st; void chk(){ for(int i=1; i<=N; i++) gp[i].clear(); ll now = 0; for(int i=0; i<M; i++){ now<<=1LL; int u = edge[i].first, v = edge[i].second; if(idx[u]<idx[v]){ int t = u; u = v; v = t; now|=1LL; } gp[u].pb(v); } vt.pb(now); } int per[MAX_N+1]; int main(){ scanf("%d%d", &N, &M); for(int i=0; i<M; i++){ int x, y; scanf("%d%d", &x, &y); edge.pb({x, y}); } for(int i=0; i<N; i++){ per[i] = i+1; } while(1){ for(int i=0; i<N; i++) idx[per[i]] = i; chk(); if(!next_permutation(per, per+N)) break; } sort(vt.begin(), vt.end()); vt.erase(unique(vt.begin(), vt.end()), vt.end()); for(int i=0; i<vt.size(); i++){ ans = (ans + __builtin_popcountll(vt[i])) % MOD; } cout<<ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 288 KB | Output is correct |
12 | Correct | 5 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 288 KB | Output is correct |
12 | Correct | 5 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 376 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 380 KB | Output is correct |
32 | Correct | 10 ms | 1012 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 15 ms | 1012 KB | Output is correct |
35 | Correct | 15 ms | 1012 KB | Output is correct |
36 | Correct | 18 ms | 1012 KB | Output is correct |
37 | Correct | 20 ms | 1012 KB | Output is correct |
38 | Correct | 22 ms | 1012 KB | Output is correct |
39 | Correct | 46 ms | 4620 KB | Output is correct |
40 | Correct | 63 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 99 ms | 4580 KB | Output is correct |
43 | Correct | 121 ms | 4580 KB | Output is correct |
44 | Correct | 139 ms | 4508 KB | Output is correct |
45 | Correct | 157 ms | 4616 KB | Output is correct |
46 | Correct | 175 ms | 4580 KB | Output is correct |
47 | Correct | 194 ms | 4584 KB | Output is correct |
48 | Correct | 65 ms | 4584 KB | Output is correct |
49 | Correct | 100 ms | 4708 KB | Output is correct |
50 | Correct | 94 ms | 4580 KB | Output is correct |
51 | Correct | 97 ms | 4580 KB | Output is correct |
52 | Correct | 486 ms | 33472 KB | Output is correct |
53 | Correct | 706 ms | 33340 KB | Output is correct |
54 | Correct | 937 ms | 33340 KB | Output is correct |
55 | Correct | 1131 ms | 33340 KB | Output is correct |
56 | Correct | 1345 ms | 33248 KB | Output is correct |
57 | Correct | 1583 ms | 33504 KB | Output is correct |
58 | Correct | 1822 ms | 33540 KB | Output is correct |
59 | Correct | 2015 ms | 33564 KB | Output is correct |
60 | Correct | 2194 ms | 33604 KB | Output is correct |
61 | Correct | 669 ms | 33468 KB | Output is correct |
62 | Correct | 1000 ms | 33468 KB | Output is correct |
63 | Correct | 1006 ms | 33344 KB | Output is correct |
64 | Correct | 1002 ms | 33480 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 288 KB | Output is correct |
12 | Correct | 5 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 376 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 380 KB | Output is correct |
32 | Correct | 10 ms | 1012 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 15 ms | 1012 KB | Output is correct |
35 | Correct | 15 ms | 1012 KB | Output is correct |
36 | Correct | 18 ms | 1012 KB | Output is correct |
37 | Correct | 20 ms | 1012 KB | Output is correct |
38 | Correct | 22 ms | 1012 KB | Output is correct |
39 | Correct | 46 ms | 4620 KB | Output is correct |
40 | Correct | 63 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 99 ms | 4580 KB | Output is correct |
43 | Correct | 121 ms | 4580 KB | Output is correct |
44 | Correct | 139 ms | 4508 KB | Output is correct |
45 | Correct | 157 ms | 4616 KB | Output is correct |
46 | Correct | 175 ms | 4580 KB | Output is correct |
47 | Correct | 194 ms | 4584 KB | Output is correct |
48 | Correct | 65 ms | 4584 KB | Output is correct |
49 | Correct | 100 ms | 4708 KB | Output is correct |
50 | Correct | 94 ms | 4580 KB | Output is correct |
51 | Correct | 97 ms | 4580 KB | Output is correct |
52 | Correct | 486 ms | 33472 KB | Output is correct |
53 | Correct | 706 ms | 33340 KB | Output is correct |
54 | Correct | 937 ms | 33340 KB | Output is correct |
55 | Correct | 1131 ms | 33340 KB | Output is correct |
56 | Correct | 1345 ms | 33248 KB | Output is correct |
57 | Correct | 1583 ms | 33504 KB | Output is correct |
58 | Correct | 1822 ms | 33540 KB | Output is correct |
59 | Correct | 2015 ms | 33564 KB | Output is correct |
60 | Correct | 2194 ms | 33604 KB | Output is correct |
61 | Correct | 669 ms | 33468 KB | Output is correct |
62 | Correct | 1000 ms | 33468 KB | Output is correct |
63 | Correct | 1006 ms | 33344 KB | Output is correct |
64 | Correct | 1002 ms | 33480 KB | Output is correct |
65 | Execution timed out | 3098 ms | 66072 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 256 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 288 KB | Output is correct |
12 | Correct | 5 ms | 256 KB | Output is correct |
13 | Correct | 5 ms | 256 KB | Output is correct |
14 | Correct | 5 ms | 256 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 5 ms | 256 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 5 ms | 256 KB | Output is correct |
20 | Correct | 5 ms | 376 KB | Output is correct |
21 | Correct | 5 ms | 376 KB | Output is correct |
22 | Correct | 5 ms | 376 KB | Output is correct |
23 | Correct | 5 ms | 376 KB | Output is correct |
24 | Correct | 6 ms | 376 KB | Output is correct |
25 | Correct | 5 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 380 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 6 ms | 376 KB | Output is correct |
29 | Correct | 6 ms | 376 KB | Output is correct |
30 | Correct | 6 ms | 376 KB | Output is correct |
31 | Correct | 6 ms | 380 KB | Output is correct |
32 | Correct | 10 ms | 1012 KB | Output is correct |
33 | Correct | 11 ms | 1012 KB | Output is correct |
34 | Correct | 15 ms | 1012 KB | Output is correct |
35 | Correct | 15 ms | 1012 KB | Output is correct |
36 | Correct | 18 ms | 1012 KB | Output is correct |
37 | Correct | 20 ms | 1012 KB | Output is correct |
38 | Correct | 22 ms | 1012 KB | Output is correct |
39 | Correct | 46 ms | 4620 KB | Output is correct |
40 | Correct | 63 ms | 4580 KB | Output is correct |
41 | Correct | 86 ms | 4580 KB | Output is correct |
42 | Correct | 99 ms | 4580 KB | Output is correct |
43 | Correct | 121 ms | 4580 KB | Output is correct |
44 | Correct | 139 ms | 4508 KB | Output is correct |
45 | Correct | 157 ms | 4616 KB | Output is correct |
46 | Correct | 175 ms | 4580 KB | Output is correct |
47 | Correct | 194 ms | 4584 KB | Output is correct |
48 | Correct | 65 ms | 4584 KB | Output is correct |
49 | Correct | 100 ms | 4708 KB | Output is correct |
50 | Correct | 94 ms | 4580 KB | Output is correct |
51 | Correct | 97 ms | 4580 KB | Output is correct |
52 | Correct | 486 ms | 33472 KB | Output is correct |
53 | Correct | 706 ms | 33340 KB | Output is correct |
54 | Correct | 937 ms | 33340 KB | Output is correct |
55 | Correct | 1131 ms | 33340 KB | Output is correct |
56 | Correct | 1345 ms | 33248 KB | Output is correct |
57 | Correct | 1583 ms | 33504 KB | Output is correct |
58 | Correct | 1822 ms | 33540 KB | Output is correct |
59 | Correct | 2015 ms | 33564 KB | Output is correct |
60 | Correct | 2194 ms | 33604 KB | Output is correct |
61 | Correct | 669 ms | 33468 KB | Output is correct |
62 | Correct | 1000 ms | 33468 KB | Output is correct |
63 | Correct | 1006 ms | 33344 KB | Output is correct |
64 | Correct | 1002 ms | 33480 KB | Output is correct |
65 | Execution timed out | 3098 ms | 66072 KB | Time limit exceeded |
66 | Halted | 0 ms | 0 KB | - |